How to find all JPEGs taken between 2021-09-25 and 2021-10-04? (recursive)

Started by feklee, October 26, 2021, 08:22:01 AM

Previous topic - Next topic

feklee

Should be a combination of find and exiftool I presume, but I'm a bit too lazy to think...

Phil Harvey

exiftool -p "$filepath" -r -if "$datetimeoriginal gt '2021:09:25' and $datetimeoriginal lt '2021:10:05'" DIR
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


feklee

Although, if I want to include September 25 and October 5, I assume I need to change to:

exiftool -p "$filepath" -r -if "$datetimeoriginal ge '2021:09:25' and $datetimeoriginal le '2021:10:05'" DIR

StarGeek

No, that would not be correct.

On the low end, the moment you add a time component it becomes greater than 2021:09:25. So every time stamp on 2021:09:25 00:00:00 through 23:59:59 will be greater than just 2021:09:25.  The only time you would really need to use ge (greater than or equal) is if, for example, you had scanned an image that you knew took place on that date but didn't know the time, and then set the tag to just 2021:09:25 without any time component. But using ge won't cause any problems, as you would still get all the time stamps on that date.

On the other end, if you want to include 2021:10:05, you need to be less than the next date because, again, when you add the time component, every time on 2021:10:05 will be greater than just 2021:10:05.  So you need to be less than 2021:10:06.  The only way you could use less than or equal to on the high end would be to use le '2021:10:05 23:59:59'
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

feklee


Good that I asked, thank you! So the original command line posted by Phil only needs one small change, 2021:10:06 instead of 2021:10:05:

exiftool -p "$filepath" -r -if "$datetimeoriginal gt '2021:09:25' and $datetimeoriginal lt '2021:10:06'" DIR

Then I should get all pictures taken between September 25 and October 5, including these dates.

StarGeek

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

Quote from: feklee on November 02, 2021, 11:54:00 AM
So the original command line posted by Phil only needs one small change, 2021:10:06 instead of 2021:10:05:

My command was correct for the date range you indicated in the title of your post, assuming you wanted the end dates to be included.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

feklee

Quote from: Phil Harvey on November 02, 2021, 04:54:08 PMMy command was correct for the date range you indicated in the title of your post, assuming you wanted the end dates to be included.

You're right. Sorry, I got confused about the dates.