ExifTool Forum

ExifTool => Newbies => Topic started by: PlasticArmyGuy on April 28, 2025, 06:16:47 PM

Title: Time range plus one or more tags as quailifer
Post by: PlasticArmyGuy on April 28, 2025, 06:16:47 PM
I have been trying to us a time range for datetimeoriginal plus one other tag to selectively apply an entry to the Event tag.  For example: 

exiftool -r -if '($DateTimeOriginal ge "2024:01:27 18:59:00" and $DateTimeOriginal lt "2024:01:27 23:59:00" and $Make eq "Nikon Corporation")' -Event="Alice Ted Reception" *.jpg

As written the command does not work.  If I remove the and $Make eq "Nikon Corporation") section the command completes okay.

How would I restate the if condition to get this to work?  Can it be restated?

Thanks. 
Title: Re: Time range plus one or more tags as quailifer
Post by: StarGeek on April 28, 2025, 07:53:33 PM
It works correctly here after I swap the quotes for my Windows CMD
C:\>exiftool -G1 -a -s -DateTimeOriginal -make -event y:\!temp\Test3.jpg y:\!temp\Test4.jpg
======== y:/!temp/Test3.jpg
[ExifIFD]       DateTimeOriginal                : 2024:01:27 15:00:00
[IFD0]          Make                            : Nikon Corporation
======== y:/!temp/Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2024:01:27 22:00:00
[IFD0]          Make                            : Nikon Corporation
    2 image files read

C:\>exiftool -r -if "($DateTimeOriginal ge '2024:01:27 18:59:00' and $DateTimeOriginal lt '2024:01:27 23:59:00' and $Make eq 'Nikon Corporation')" -Event="Alice Ted Reception" y:\!temp\Test3.jpg y:\!temp\Test4.jpg
    1 files failed condition
    1 image files updated

C:\>exiftool -G1 -a -s -DateTimeOriginal -make -event y:\!temp\Test3.jpg y:\!temp\Test4.jpg
======== y:/!temp/Test3.jpg
[ExifIFD]       DateTimeOriginal                : 2024:01:27 15:00:00
[IFD0]          Make                            : Nikon Corporation
======== y:/!temp/Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2024:01:27 22:00:00
[IFD0]          Make                            : Nikon Corporation
[XMP-iptcExt]   Event                           : Alice Ted Reception
    2 image files read

What command line/OS are you using? Are you sure that the DateTimeOriginal and Make tags exist in the file?

What is the exact output from your command?
Title: Re: Time range plus one or more tags as quailifer
Post by: PlasticArmyGuy on April 28, 2025, 08:26:00 PM
Dumb mistake on my part.  The Make value should have been in all caps i.e. NIKON CORPORATION in my command.

Thanks for replying.  Knowing the command should work basically lead me to my error.