ExifTool Forum

ExifTool => Newbies => Topic started by: Tomhughes on December 15, 2016, 06:03:26 PM

Title: Find images with two people identified in them
Post by: Tomhughes on December 15, 2016, 06:03:26 PM
Exiftool lets me easily locate images with a person identified:

exiftool -if '$regionname eq "Thomas Hughes"'  -filename -ext jpg -r .

How do I find files with two people (logical AND) in them? I tried this:

exiftool -if '$regionname eq "Thomas Hughes" and $regionname eq "Catherine Hughes"'  -filename -ext jpg -r .

But that didn't return any results. I'm using Mac OS X 10.11 and exiftool 10.36.

Many thanks!
Title: Re: Find images with two people identified in them
Post by: StarGeek on December 15, 2016, 06:53:08 PM
Your first command will find images that only have Thomas Hughes in them.  It won't find images with Thomas Hughes and someone else.  To do that, you would have to use
exiftool -if '$regionname=~/Thomas Hughes/i' -filename -ext jpg -r .

To find more than one person, try this
exiftool -if '$regionname=~/Thomas Hughes/i and $regionname=~/Catherine Hughes/i' -filename -ext jpg -r .
Title: Re: Find images with two people identified in them
Post by: Tomhughes on December 15, 2016, 07:41:41 PM
Wow, thank you. This does exactly what I want. Is there a reference you can point to that explains the syntax in the -if statements? I don't quite understand the role of the tildes and the slashes.
Title: Re: Find images with two people identified in them
Post by: Hayo Baan on December 16, 2016, 02:04:50 AM
Quote from: Tomhughes on December 15, 2016, 07:41:41 PM
Wow, thank you. This does exactly what I want. Is there a reference you can point to that explains the syntax in the -if statements? I don't quite understand the role of the tildes and the slashes.
That is the normal perl regular expression syntax (http://perldoc.perl.org/perlre.html).
Title: Re: Find images with two people identified in them
Post by: StarGeek on December 16, 2016, 06:51:13 PM
Here's another resource (http://www.tutorialspoint.com/perl/perl_regular_expression.htm) that might be a bit less technically and easier to learn from.  I always find perldoc.perl.org pages to be harder to learn new things from.
Title: Re: Find images with two people identified in them
Post by: Tomhughes on December 18, 2016, 02:29:44 PM
Thank you -- that second resource is that much clearer!