How to PRESERVE SOME tags and DELETE REST

Started by Archive, May 12, 2010, 08:54:40 AM

Previous topic - Next topic

Archive

[Originally posted by weddinger on 2009-09-13 21:03:36-07]

Hi there,

I'm stuck, I've been trying to do a simple - on the first view - thing for the last 8 hours... and cannot get an acceptable solution, so please help.

Target: my pictures have a lot of stuff in the exif, I want to remove most of it keeping a few as they are. Additionally I want to add some other field not existing in the original file.

Solution: keep some, remove the rest (not specifying it explicitly), add new tags.

Problem: there is nothing like "remove the rest" - one has to provide explicit tag names or delete whole groups. The thing is - I don't know all the tags, I just now what I want to keep!

I tried to copy just the wanted tags using -tagfromfile, but it requires an existing file as destination; it does NOT create a file (it should according to the documentation - Bug?). Then I took the -o option to explicitly create a new file, but it copies EVERYTHING from the source...

I ended up with a solution with a temp-file (create tmp file, copy wanted tags, remove all tags from source, copy saved tags back, add extra tags), which unfortunately requires 5 (FIVE!) calls of the exiftool. It wouldn't be so bad and I could live with it, but I'd like to convert whole directories at once and I wouldn't like to combine exiftool with other cms-scipts....

There must be a simple way to do the thing, it's an usual case, I just cannot believe there is no way to do that nicely. Please let me know if have any idea.

Cheers,
weddinger

Archive

[Originally posted by exiftool on 2009-09-13 22:47:29-07]

To do this, you delete everything and copy back the
tags you want to keep in one step, like this:,

Code:
exiftool -all= -tagsfromfile @ -title -artist -fnumber ... DIR

... adding only the tags which you want to keep.

- Phil