Need help how to make script working.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
FKCapitalism
Posts: 1
Joined: 05 Feb 2022 10:29

Need help how to make script working.

#1 Post by FKCapitalism » 05 Feb 2022 10:31

I have hundreds of JPEG images in folders (folders already divided by date) need to split images into sub-folders by time created.

How can above described stacking be implemented using windows command line (batch file) with actual JPEG file on my windows explorer?

Lets say i want to group files that have 10 seconds time gap between creation.
  • Sort files by "date modified" Ascending
  • Set first file (time modified is 2:51:15) as reference point for comparison
  • Check second file in list IF time modified is 2:51:17 (within 10 seconds gap from reference point file) then:
    - create sub-folder, name sub-folder with name of first file (minus extension) and move both first and second files there
  • Check third file IF time modified is 2:51:23 (within 10 seconds gap) then move third file into previously created sub-folder as well
  • Check fourth file IF time modified is 2:51:45 (more than 10 seconds gap from reference point file) then don't move fourth file into sub-folder:
    - stop comparison against first file, set fourth file (time modified 2:51:45) as reference point for comparison
  • Check fifth file IF time modified is 2:51:49 then
    - create sub-folder, name sub-folder with name of fourth file (minus extension) and move both fourth and fifth files there
  • If sixth file time modified is 2:53:18 (more than 10 seconds gap from reference point file (fourth)) then:
    - stop comparison against fourth file, set sixth file (time modified 2:53:18) as reference point for new comparison
  • And so on until all files are checked and moved into sub-folder.

batmanbatmanbatmen
Posts: 9
Joined: 23 Sep 2022 22:13

Re: Need help how to make script working.

#2 Post by batmanbatmanbatmen » 24 Sep 2022 04:41

1. folders already divided by date <-- only write one script for one folder is ok.

2. within 10 seconds <--- luckly folders already divided by date.
Using following command to get files time down to second level so that you can calculate the 10 sec gap.
c:\wmic DataFile where "Name='c:\\path\\file.txt'" get LastModified /VALUE

3. Script apply to all others date folder.

4. If want also handle the original file have 10 sec gap but at different folder date, suggest write another script to do this.

Post Reply