ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: russelljtdyer on May 26, 2015, 07:10:26 AM

Title: List of Image Files
Post by: russelljtdyer on May 26, 2015, 07:10:26 AM
Is there a way that I can get a list of image files in a directory based on a particular value of a particular tag?  For instance, suppose I want a list of photos that were made with a Canon P camera.  I know that I can check one image file by using the exiftool with grep like this:

exiftool photo-001.jpg |grep "Canon P"
Camera Model Name               : Canon P


But I don't want to check manually each image file.  Instead, I just want a list of image file names in which the Model tag has the value of Canon P.  I would think I could use the -if option to check all of the image files and return a list of FileName values.  I tried a few variations of this idea.  Here's one of them:

exiftool -execute -if "$exif:model eq 'Canon P'" -T -FileName *jpg

This runs for a while and, although there are a few photos in the directory with the Model set to Canon P, it produced no results.  Is it possible to do what I want from the command-line?  If so, what am I doing wrong?  How do I do this?  Or do I need to do it in Perl in a more intensive way? 

Thanks in advance for any suggestions or help.

-Russell
Title: Found the Solution
Post by: russelljtdyer on May 26, 2015, 07:34:25 AM
I found a solution.  It's funny how I can search for so long and experiment so many times, but it's not until I post a question that I find the answer.  Here it is:

exiftool -if '$exif:Model =~ m|Canon P|' -T -FileName *jpg