if *_std.idx(
not sure what you think this will do?
Anyhow, I use this modified version (changed line in blue)
@echo off
set thisdir=%cd%
Echo Scanning subfolders
for /f "delims=" %%D in ('dir /b /ad') do (
echo Entering subfolder: %%D
cd /d "%%D"
Echo Renaming *_std to *_std.mpg
if exist *_std (
for /f "delims=" %%S in ( ' dir /b *_std ^| find /v "_std.idx" ' ) do (
echo Renaming %%S to %%S.mpg
ren "%%S" "%%S.mpg"
)
) else (
echo *_std : no files to process
)
Echo Renaming 2-* to 9-* to 02-* to 09-*
for %%N in (2 3 4 5 6 7 8 9) do (
if exist "%%N-*" (
for /f "delims=" %%F in ('dir /b %%N-*') do (
echo Renaming %%F to 0%%F
ren "%%F" "0%%F"
)
) else (
echo %%N-* : no files to process
)
)
cd /d %thisdir%
)
pause