In need of Batch file to delete photos taken between certain times

I-am working on a timelapse project of my aquarium, however i use an old LG G3 as timelapse camera and tasker does not seem to care about the task times i gave it.

So now i need to delete pictures.

I want to keep pictures taken between 10:00 and 20:00 and delete every picture taken between 20:00 and 10:00
In the photo details it has “Date taken” data with a timestamp to the minute precise.

And the file name of the pictures are for example "timelapse_photo124.30-09-2017.10.12.17"
So "timelapse_photo.picture-number.day.month.year.hour.minute.second"
picture-number ofcourse increments with every picture taken up to 99999.

My batch writing skills have gone away so who’s up for this task?
I can’t re configure the phone anymore as the timelapse has already started.
I download the pictures of the phone via FTP btw,

Is the modification time set correctly? Can you use bash?

nope modification time is incorrect, and my bash is oke, however i don’t want to set up a linux environment just for this.
And i know it can be done with a bat file. just don’t know how (anymore) hehe.

Are you in Windows?

yes he is, thats why he needs a .bat script.

2 Likes

Not going to set up a VM to test this for you, but it is the third link that I found that brought up forfiles.

i-am afraid such a attempt won’t work as the modified date is wrong (because of copying it from a server)

Is there no way on windows to preserve the time? rsync has the -a option for example but I don’t know about windows.

If I understand it correctly, the time is there on two places:

  1. Filename (timelapse_photo124.30-09-2017.10.12.17), the filename pattern therefore is

timelapse_photo<counter>.<dd>-<mm>-<yyyy>.<hh24>.<mi>.<ss>.<extension>

  1. Date taken (exif)

As long first one applies, I would opt for simple regexp match on file name.
Shall be pretty easy in python (is that an option?), or I need to check batch on regular expressions.

Try this regexp (it’s ready to use there, I was lazy to deal with character escaping in the post):
https://regex101.com/r/M6VWZs/1

Freecommander can handle it as well:

1 Like

nice post, thank you.
I was wondering if batch has some useful regular expressions or wildcards.