Replacing a keyword with another one in the keyword list

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

Previous topic - Next topic

Archive

[Originally posted by hobbyphotographer on 2008-07-02 13:47:06-07]

Is it possible to replace a keyword with another keyword.

Example: The image has the following keywords: A, B, C. Now I want to replace B with D. Is this possible using ExifTool?

Any help will be much appreciated.

Archive

[Originally posted by exiftool on 2008-07-02 14:02:23-07]

This command will do it:

Code:
exiftool -keywords-=B -keywords+=D FILE

but note that the resulting order of the keywords will then be A, C, D

- Phil

Archive

[Originally posted by hobbyphotographer on 2008-07-02 14:11:50-07]

Thanks a lot for the command.

Sorry, I forgot to write my original intention.

I have a folder full of images with different tags. I want to replace a particular keyword with another, only on those images which has the original keyword.

Example: I have 3 files with 2 of them defining the keyword B. I want to run a batch command replacing the keyword B with D.

Sorry for the confusion.

Archive

[Originally posted by exiftool on 2008-07-02 14:27:19-07]

OK, here you go:

Code:
exiftool -if "$keywords =~ /\bB\b/i" -keywords-=B -keywords+=D DIR

Use double quotes as above in Windows, or single quotes with other
operating systems.  The "i" after the regular expression does a case-insensitive
test, so you should remove it if you want case sensitivity.  The two "\b" in the
expression match at word boundaries.

- Phil