Link to home
Start Free TrialLog in
Avatar of honestman31
honestman31

asked on

batch file to move files to folders based on their names

Hello experts ,
I have over 6000 mp3 files ( see attached ) in one folder
every file name is just 6 digits
 what I want is a batch file that do the following
1- moving every file to a folder ( create folder if not exit  )  based on the first 3 digits on the file name  ( leading zeros should be removed )

2- the  new   file name  must be the last 3 digits of the old file name ( leading zeros should be removed )

examples.

002001.mp3    should be moved to the folder named 2    and the new file name should be 1.mp3


023051.mp3    should be moved to the folder named 23    and the new file name should be 51.mp3
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of honestman31
honestman31

ASKER

Hi,
I think something wrong with this file ,  I ran it live and I got up to folder 37  , should be 114 folders though
Thanks
Well - what happened?
Any error messages, and if so, which ones?
Are there other mp3 files in the source folder that do not match the file name pattern you specified?
u r correct , it is my fault , something was wrong with original folder & files , fixed that  and it works fine
just doing my final check on it , I'll let you know if i have nay problem
Many thanks