Author Topic: Check more than 1 file type  (Read 2458 times)

edif30

  • Jr. Member
  • **
  • Posts: 12
Check more than 1 file type
« 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.



Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
Re: Check more than 1 file type
« Reply #1 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.
« Last Edit: May 26, 2015, 09:24:54 AM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

edif30

  • Jr. Member
  • **
  • Posts: 12
Re: Check more than 1 file type
« Reply #2 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!

edif30

  • Jr. Member
  • **
  • Posts: 12
Re: Check more than 1 file type
« Reply #3 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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
Re: Check more than 1 file type
« Reply #4 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

edif30

  • Jr. Member
  • **
  • Posts: 12
Re: Check more than 1 file type
« Reply #5 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?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16687
    • ExifTool Home Page
Re: Check more than 1 file type
« Reply #6 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
« Last Edit: May 26, 2015, 01:12:32 PM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

edif30

  • Jr. Member
  • **
  • Posts: 12
Re: Check more than 1 file type
« Reply #7 on: May 26, 2015, 01:06:43 PM »
Got it.  Awesome.  Thanks Phil!