Incrementing folder modification time based on an ordered folder list
Posted: 08 Aug 2017 09:30
Hi all
I'm looking to read set and increment by one second the File Modification Time of a series of folders (and all their contents) inside a parent folder. The first four letters of each folder name in the subdirectory I want to work in are a numeric sequence, which should form the basis of the sequence and incrementing.
An example:
.\albums\0001 first album name
.\albums\0002 second album name
.\albums\0003 third album name
...
I'm looking to write a batch script that will do the following:
- obtain a list of parent directories within the folder it is run from
- obtain the first four characters and store these as a substring
- sort the substrings in ascending order
- modify the File Modification Time of each parent directory and all its contents using a single seed date and timestamp, incremented by one second for every change in parent folder
I'd be happy to hard code the seed date and timestamp in the file.
So in the example folder list above if the seed date and timestamp were today at 13:00
.\albums\0001 first album name date and timestamp would be today at 13:00:00
.\albums\0002 second album name date and timestamp would be today at 13:00:01
.\albums\0003 third album name date and timestamp would be today at 13:00:02
I've not used a Windows/DOS batch file in donkey's years. Can it be done?
I'm looking to read set and increment by one second the File Modification Time of a series of folders (and all their contents) inside a parent folder. The first four letters of each folder name in the subdirectory I want to work in are a numeric sequence, which should form the basis of the sequence and incrementing.
An example:
.\albums\0001 first album name
.\albums\0002 second album name
.\albums\0003 third album name
...
I'm looking to write a batch script that will do the following:
- obtain a list of parent directories within the folder it is run from
- obtain the first four characters and store these as a substring
- sort the substrings in ascending order
- modify the File Modification Time of each parent directory and all its contents using a single seed date and timestamp, incremented by one second for every change in parent folder
I'd be happy to hard code the seed date and timestamp in the file.
So in the example folder list above if the seed date and timestamp were today at 13:00
.\albums\0001 first album name date and timestamp would be today at 13:00:00
.\albums\0002 second album name date and timestamp would be today at 13:00:01
.\albums\0003 third album name date and timestamp would be today at 13:00:02
I've not used a Windows/DOS batch file in donkey's years. Can it be done?