Posted on 2010-03-19 12:30:03.968209-07 by peterlustig
Question: replace keyword
Dear community, I am trying to replace a certain keyword by another. Based on the application documentation I try
exiftool -if '$keywords =~ "03_Vortag"' -keywords-="03_Vortag" -keywords+="Vortag"
alternatively also
exiftool -if '$keywords =~ /03_Vortag/' -keywords-="03_Vortag" -keywords+="Vortag"
but it does not work. I only get "files failed condition". The keyword "03_Vortag" that should be replaced is a) not present in all files, which is why I need the if-condition (otherwise I end up with the keyword "Vortag" in all files b) only one keyword among others. Would be great if anyone could give me a clue what I am doing wrong? Best, Peter
Direct Responses: 12580 | Write a response
Posted on 2010-03-19 18:01:43.099657-07 by exiftool in response to 12579
Re: Question: replace keyword
Hi Peter,

What system are you using? What you have done will work provided that you are on Mac or Linux. If you are on Windows, you need to swap the single and double quotes in the -if expression.

Also, you need to specify a filename, but hopefully that is obvious.

One more note: The -if condition will pass if any keyword contains the string "03_Vortag", but the matching tag will only be deleted if it is exactly "03_Vortag". This probably isn't a concern, but just to warn you that keywords like "003_Vortag" will match but won't get deleted.

- Phil
Direct Responses: 12583 | Write a response
Posted on 2010-03-21 02:17:07.888795-07 by peterlustig in response to 12580
Re: Question: replace keyword
GREAT, thanks so much! Yes, I am working on Win, and switching single and double quotes did the trick. Really great getting your help so quick, thank you!
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.