I have a directory of folders and I am trying write a windows batch script to sort the folders by name and then copy the files in the first folder to a different location.
Directory
Here "2020-09-02" and "2020-09-01" are folders (or sub-folders under the folder 'Directory'). Each folder (2020-09-02 and 2020-09-01) has a set of files inside them.
I need to pick the folder 2020-09-01 (as that is the oldest folder) and copy the files inside the folder 2020-09-01 into a different location, and then delete the folder 2020-09-01.
I do not need to do this in a loop (to process all folders under 'Directory'). I just need to be able to pick the folder with least date and process that folder alone.
I am good with the code to copy the files in a directory to a different location, but having trouble to be able to select the folder with oldest date (without a for loop).
Any help is appreciated. Thanks in Advance!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…