1
I have many excel files in a single folder like below.
+----------------------+
| 01012019_LOC001.xlsx |
| 01012019_LOC002.xlsx |
| 01012019_LOC003.xlsx |
| 02012019_LOC001.xlsx |
| 02012019_LOC002.xlsx |
| 02012019_LOC003.xlsx |
| 03012019_LOC001.xlsx |
| 03012019_LOC002.xlsx |
| 03012019_LOC003.xlsx |
+----------------------+
a date plus Location combination structure DDMMYYYY_LOCXXX
I want to move these files to it's respective folders created similar to the below structure.
MAIN_FOLDER
|
|-LOC001
|-01012019
|-02012019
|-03012019
|
|-LOC002
|-01012019
|-02012019
|-03012019
|
|-LOC003
|-01012019
|-02012019
|-03012019
|
I can transfer one at a time with for /r %d in (01012019_LOC001.xlsx) do move "%d" "C:MAIN_FOLDER\LOC001\01012019\"
.
But I'm looking for a more dynamic solution. Hence, please guide me to find a solution.
P.S.Note:- even a powershell answer would suffice.
For this you'll want to loop through the files with delayed expansion; the tricky part is splitting the filename up, though if the date string and loc string are set numbers of characters, you can cheese it with variable substrings. I'll type of an answer if I have a moment. – mael' – 2019-08-21T19:34:27.363