Help with -if syntax -- SOLVED -- THANK YOU

Started by bobndanishopping1, November 08, 2020, 02:49:22 AM

Previous topic - Next topic

bobndanishopping1

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







     

sevy

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

greybeard

exiftool -FileName -Model -if "$model eq 'NIKON D200'" -ext jpg -r "P:\Pictures\Pictures" -csv > exifdata.csv

bobndanishopping1

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

StarGeek

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.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype