ExifTool Forum

ExifTool => Newbies => Topic started by: edif30 on May 25, 2015, 08:22:48 PM

Title: Check more than 1 file type
Post by: edif30 on May 25, 2015, 08:22:48 PM
I am trying to do a search and I'd like to check more than 1 file type but I think my syntax is off.  I know very little perl, and that's to say less than minimal. 

This is the command I am running for 1 file type "JPEG"

exiftool -filename -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")' /mnt/nano/photo_backup/ -common -csv > /mnt/nano/photo_backup/noexif_cdates.csv

But I'd like to check on multiple file types.  Would I have to do an or?  Like this?  $filetype eq "JPEG" or $filetype eq "PSD" Or is there a simpler way?  I'd rather specify the file types versus an ALL.  BTW... I am also curious if I can do that as well.  For instance $filetype:ALL.


Title: Re: Check more than 1 file type
Post by: Phil Harvey on May 26, 2015, 06:52:59 AM
Your syntax looks good to me, and should process the file if the DateTimeOriginal is missing or all zeros, and the FileType is "JPEG".  However, using the -ext option instead of checking FileType would be preferable if the files have the proper extension.  You can use multiple -ext options in a single command.

I don't know what you want to do with $filetype:all, but that won't work.

- Phil

Edit: Added missing word.
Title: Re: Check more than 1 file type
Post by: edif30 on May 26, 2015, 09:21:53 AM
Thanks

I wasn't sure if the :all would work in that case.  I'll give the -ext a try and see what I can come up with. I guess to be sure I have all the extensions correct I can clean that up and then go back to my search for create date and go from there.

Appreciate the advice!
Title: Re: Check more than 1 file type
Post by: edif30 on May 26, 2015, 10:53:02 AM
Phil,

Before I go the -ext route... Would this work?

exiftool -filename -r -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG" or $filetype eq "PSD")' /mnt/nano/photo_backup/ -common -csv > /mnt/nano/photo_backup/noexif_cdates.csv
Title: Re: Check more than 1 file type
Post by: Phil Harvey on May 26, 2015, 11:35:00 AM
Yes, it will work.  I recommended -ext because you can avoid processing the file entirely if it is the wrong type, while the -if condition still needs to read all the tags from the file before it makes its decision.  So -ext is a lot faster.

- Phil
Title: Re: Check more than 1 file type
Post by: edif30 on May 26, 2015, 12:25:38 PM
So if I understand this correctly once exiftool finds the creation date for the specified -ext it will capture what I am searching for and then move onto the next file, versus $filetype reading the entire metadata fields?
Title: Re: Check more than 1 file type
Post by: Phil Harvey on May 26, 2015, 12:28:44 PM
No.

-ext specifies the files to read.  Then the -if condition is applied only for the files that are read.

So the creation date isn't even considered if the extension doesn't match your -ext option(s).

- Phil

Edit: Fixed typo
Title: Re: Check more than 1 file type
Post by: edif30 on May 26, 2015, 01:06:43 PM
Got it.  Awesome.  Thanks Phil!