I have a root folder: C:UsersuseameDesktopNew folder which contains .mp3 files that are named like this:
20162406_3346_234958_97270791720411
20162305_3315_163017_97620734220699
I tried creating a batch that would sort them by the first 5-digits of the 4th series of numbers ( the 97270 or 97620 in this case) create folders named like that and then move all the files into their specific folder.
Here is what I've come up with:
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
set "sourcedir=C:UsersuseameDesktopNew folder"
for /f "tokens=1,2,3,4 delims=_" %%a in ('dir /b /a-d *_*_*_*.mp3') do (
set x= %%d
set y= !x:~1,5!
mkdir "!y!" 2>nul
move "%%a_%%b_%%c_%%d" "!y!"
)
endlocal
It works! but, I would like to know how to add text to the folder names, like have the created folder named:
97270 - Bla Bla Bla or
Bla Bla Bla - 97270
The 'Bla Bla" should not depend on anything taken from the file name, rather have it set by the user from withing the batch.
I have not managed to find the proper syntax for it.
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب:
نویسنده: استخدام کار
بازدید: 238
تاريخ: شنبه
5 تير
1395 ساعت: 17:34