Like I said in JREN topic, I'm trying to rename recursively files with alphabetical order to give a right order to a car radio. I need to have incrementing continued beacause tha car radio mix all songs. My code is like this :
Code: Select all
set zero=000
REM for /f "delims=" %%a in ('dir "E:\" /b /o:n') do (
for /r "E:\" %%a in (.) do (
pushd "%%a"
for /f "delims=" %%j in ('dir /b/a-d/on ^| findstr /ile ".flac .mp3"') do set VrOldName=%%j& set VrFile=%%~nxj& set /a Nincr+=1& call :renaming
popd)
:renaming
if /i %Nincr% GTR 9 set zero=00
if /i %Nincr% GTR 99 set zero=0
if /i %Nincr% GTR 999 set zero=
ren "%VrOldName%" "%zero%%Nincr%_%VrFile%"
I still didn't find how to get the right order for directories as for /r doesn't sort like 'dir "E:\" /b /o:n'.
Also, jren.bat would almost work except the incrementing and ordering problems. I tried of course :
Code: Select all
jren "(.*)(\.mp3|\.flac)$" "$n+'_'+$1+$2" /nbeg 1 /npad 4 /j /i /s /pm "/p:**"
So, if you can give me some alternatives, I would be very happy
Cheers
EDIT : jren v2.7 and its /nkeep option solved incrementing problem, BIG THANKS to Dave !!