ExifTool Forum

ExifTool => Newbies => Topic started by: ginger on October 09, 2018, 05:44:05 PM

Title: Boolean logic in Exiftool
Post by: ginger on October 09, 2018, 05:44:05 PM
Hi everyone.

I would like a bit of help from you.
I know we can check several conditions with boolean OR in the following way:

exiftool  -if '$Caption-Abstract =~ /Word1|Word2|Word3/i'


How do we perform the following boolean expression (for the conditions of any exif tag)


(Word1 OR Word2) AND word3 and NOT word4


Many thanks!
Title: Re: Boolean logic in Exiftool
Post by: StarGeek on October 09, 2018, 05:55:16 PM
Try
exiftool -if '$Caption-Abstract=~/Word1|Word2/i and $Caption-Abstract=~/Word3/i and $Caption-Abstract!~/Word4/i'
or
exiftool -if '$Caption-Abstract=~/Word1|Word2/i and $Caption-Abstract=~/Word3/i and not $Caption-Abstract=~/Word4/i'

!~ is the negative version of =~.  And you could always just use NOT if you like.