What is the syntax for nesting -if statements? Say that I have two possible "good" Keyword/Title field combinations and I want to find all other "bad" Keyword/Title field combinations. Anything I write makes it essentially consider all Title fields as bad because I'm doubling my or, not doubling my if (if that makes sense :-[ )
exiftool -if "$keywords =~ /Good/i and $Title !~ /Good1/" [or?] -if "$keywords =~ /Good/i and $Title !~ /Good2/" [...rest of code]
This would be where a little Perl knowledge can help. I believe and has a higher precedence than or, so the parentheses may not be necessary, though adding does help to make it more obvious.
exiftool -if "($keywords=~/Good/i and $Title!~/Good1/) or ($keywords=~/Good/i and $Title!~/Good2/)" [rest of code]
Thanks. When I run this, it processes all the photos as having "bad" metadata because it runs one IF then another IF, not running both at the same time. I tried nesting the OR and it results in the same thing. I have a test folder with three test files; two with "good" metadata, one with "bad", and all files end up getting copied as being "bad".
If you were more specific about the exact value of the tags, the exact command you used, and your expected result then I could help.
- Phil
Apologies for being vague. Here is my code.
exiftool -if "($keywords =~ /Portrait/i and $Title !~ /Approved/) or ($keywords =~ /Member Portrait/i and $Title !~ /Sessions/)" -o "D:\All Portraits\Good Metadata" "D:\All Portraits"
We need the value of the tags as well.
Also, if Title does not exist in the file, that result will always be false.
The values of the tags are in that code.
As far as a blank Title field, I have another line of code to deal with that.
To correct a small issue, here is the code:
exiftool -if "($keywords =~ /Portrait/i and $Title !~ /Approved/) or ($keywords =~ /Portrait/i and $Title !~ /Sessions/)" -o "D:\All Portraits\Good Metadata" "D:\All Portraits"