Copying files only created within a specified daily time interval

Started by Magnus, April 02, 2021, 10:33:59 AM

Previous topic - Next topic

Magnus

Hi!

First of all thanks to Phil for providing this excellent tool! :)

I'm completely new and have never used ExifTool before. I've been looking for a solution for a particular problem — and stumbled upon ExifTool which might help to solve it. However, after almost two hours of reading the documentation, I'm still not sure how to proceed. :/

Perhaps you can offer some help? — So here's my problem:

I have hundreds of image files taken during many weeks, stored in one directory. Now I want to copy only those files into another (sub) directory, which are created within a given time interval, e.g. between 14:10 and 14:25. The date doesn't matter, so only the time itself is relevant.

I found out that something like

exiftool -if '$DateTimeOriginal ge [...]' -if '$DateTimeOriginal le [...] -o SUBDIR DIR

might work. But I don't know how to access the Time part of the DateTime variable only.

Maybe a shell script is necessary to do the job? Hopefully not ... I'm using MacOS, but I've only got basic knowledge of shell commands/scripting.

Maybe you could offer some help? Any assistance is highly appreciated, since it's an important issue for me ...

Thanks a lot in advance — and have a wonderful weekend.

Best regards,
Magnus



StarGeek

So a specific time regardless of the date?

As long as you're not using any other time related tags, you can use the -d (dateFormat) option to only display the time (see Common Date Format Codes)
exiftool -d '%H:%M:%S' -if '$DateTimeOriginal ge "14:10" and $DateTimeOriginal le "14:25" ' -o SUBDIR DIR

The only question is to the seconds.  Do you wish to include 14:25:00 but not 14:25:01?  Or just less than 14:25?  The above command will not include either as 14:25 is less than 14:25:00.  Just add the seconds depending upon the results you're after.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Magnus

Thanks so much for your reply. :)

Yes, a specific time regardless of the date.
Your solution works perfectly – great! :)

In this scenario, seconds don't matter so much. But now I know how to include them as well.

Thanks again for your help. Have a wonderful day!

Best regards,
Magnus