Posted on 2007-12-04 16:17:44-08 by heiko
Adding Keyword if it does not exist
Hello, I like to add a keyword only if this keyword does not exists. I've tried the following: exiftool "-Keywords+=hugo" -if "not $Keywords=~/hugo/" *.jpg but I always get the message "x files failed condition". Can you say me whats wrong with this condition? Heiko
Direct Responses: 6617 | Write a response
Posted on 2007-12-04 16:31:08-08 by exiftool in response to 6616
Re: Adding Keyword if it does not exist
Hi Heiko,

What you have done should work in Windows. If you are in Unix, you would need to use single quotes instead.

I copied your exact command and it works fine for me here.

You can test your condition with an extract command. Try these:

exiftool -keywords -if "not $Keywords=~/hugo/" *.jpg exiftool -keywords -if "$Keywords=~/hugo/" *.jpg

The first command should print keywords for all files without "hugo" in the keywords, and the second should print all the keywords with "hugo".

- Phil
Direct Responses: 6618 | Write a response
Posted on 2007-12-04 16:41:02-08 by heiko in response to 6617
Re: Adding Keyword if it does not exist
oh, sorry Phil, all my tests with hugo. hugo was already in the keywords. Your are right, it works .. Heiko
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.