ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Lybecker on January 06, 2023, 07:27:11 AM

Title: Filter by date
Post by: Lybecker on January 06, 2023, 07:27:11 AM
Hi,

I'm trying to find all the photos taken in 2022, so I use this command:

exiftool.exe if "$DateTimeOriginal > '2022:01:01'" -T -FileName -DateTimeOriginal <folder>

But I get back, which I do not expect:

6f1f5946-0f3f-4bc7-bbdf-35b3f4f28812.jpg        2019:12:27 08:22:43
77F135B4-4DA2-416E-B4A4-08C75D6259FA.jpg        2019:11:05 20:39:02
79461fdc-6379-46a9-bcbd-f9162189ba45.jpg        2022:11:27 23:30:26
7D26FBDB-4736-4EBC-BEB6-D19F31508DAD.jpg        2019:10:22 17:55:10

What am I doing wrong?

Next step is to copy the files to another location...
Title: Re: Filter by date
Post by: Phil Harvey on January 06, 2023, 07:36:29 AM
">" is for numerical comparisons, but "2022:01:01" is not a number.  Use the string comparison "gt" operator instead.

- Phil
Title: Re: Filter by date
Post by: Lybecker on January 06, 2023, 07:49:14 AM
Unfortunately, the same result with:

exiftool.exe if "$DateTimeOriginal gt '2022:01:01'" -T -FileName -DateTimeOriginal <folder>

version 12.53
Title: Re: Filter by date
Post by: Lybecker on January 06, 2023, 07:54:12 AM
It was the missing dash(-) in front of the 'if' statement. Below works!

exiftool.exe -if "$DateTimeOriginal gt '2022:01:01'" -T -FileName -DateTimeOriginal <folder>
Title: Re: Filter by date
Post by: Phil Harvey on January 06, 2023, 08:00:14 AM
You should have also seen this error then:

Error: File not found - if
- Phil
Title: Re: Filter by date
Post by: CoraHudson on January 23, 2023, 02:31:47 PM
To choose the dates you wish to sort by, drag down the column.