Found a pyhton solution here, but I need a batch file-based solution.
Have many files:
- SSP4325_blah-blah-blah.xml
- JKP7645_blah.xml
- YTG6457-blah-blah.xml
And folder names that contain a piece of the file name:
- RefID - SSP4325, JKP7645, GHT1278, YRR0023
- RefID - YTG6457
I'm looking for a batch solution which would read a portion of the file name at the front (before either the first dash or underscore) and then move that file into the folder where the front of the filename exists as part of the folder name.
So in the above examples, the first two files (SSP4325 and JKP7645) were moved into the first folder because it contained it contained that text as part of the folder name.
The third file would be moved into the second folder.
I have hundreds of files and 63 folders. So I'm hoping to be able to automate.
Can't use Powershell or Python due to limitations of the environment. So hoping for a batch file approach.
Thanks. Sean.