ExifTool Forum

ExifTool => Newbies => Topic started by: bobndanishopping1 on November 08, 2020, 02:49:22 AM

Title: Help with -if syntax -- SOLVED -- THANK YOU
Post by: bobndanishopping1 on November 08, 2020, 02:49:22 AM
Someone please help me with -if syntax.  Trying for the life of me to learn this...

If I run in a Win7 CMD window
     exiftool -FileName -Model -ext jpg -r "P:\Pictures\Pictures" -csv > exifdata.csv
The output is
     FileName           Model
     DSC28523.JPG   NIKON D200
     DSC28537.JPG   NIKON D200

But if I run
     exiftool -FileName -Model -if Model="NIKON D200" -ext jpg -r "P:\Pictures\Pictures" -csv > exifdata.csv
The output is
     2 files failed condition
     0 files read

I have tried every combination of ", $, ', eq, =, and '$Model=NIKON D200' etc that  I have seen on any webpage and nothing seems to work.  I am at my whits end...

Thanks,
-Bob







     
Title: Re: Help with -if syntax
Post by: sevy on November 08, 2020, 03:03:33 AM
hello,

did you try :
exiftool -if "$Model=~/D200/"-FileName -Model -ext jpg -r "P:\Pictures\Pictures" -csv > exifdata.csv
or
exiftool -if "$Model=~/NIKON D200/"-FileName -Model -ext jpg -r "P:\Pictures\Pictures" -csv > exifdata.csv
Title: Re: Help with -if syntax
Post by: greybeard on November 08, 2020, 03:22:48 AM
exiftool -FileName -Model -if "$model eq 'NIKON D200'" -ext jpg -r "P:\Pictures\Pictures" -csv > exifdata.csv
Title: Re: Help with -if syntax
Post by: bobndanishopping1 on November 08, 2020, 10:14:51 AM
greybeard,
Thank you, thank you, thank you.  That worked!!!!!!!!!!!!! 

I could swear I tried that, but maybe in my late night frustration I missed something.  I have done enough programing to know syntax is a must. Now i am off and running to learn some more Exiftool syntax.

-Bob
Title: Re: Help with -if syntax
Post by: StarGeek on November 08, 2020, 10:46:31 AM
Quote from: bobndanishopping1 on November 08, 2020, 10:14:51 AMI have done enough programing to know syntax is a must. Now i am off and running to learn some more Exiftool syntax.

Exiftool is Perl based, so learning some of the basics of Perl helps a lot with the more advanced commands.