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.
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.
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!
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
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
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?
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
Got it. Awesome. Thanks Phil!