windows 7 - Intuitive file sorting in batch scripts? -


so in windows explorer, have these files sorted this:

enter image description here

i have script remove brackets , 1 zero, , in case trailing number greater or equal 10, remove 2 zeroes:

cd c:\folder setlocal enabledelayedexpansion   set /a count=0  %%a in (*.jpg) (     set /a count+=1     echo !count!     set f=%%a     if !count! gtr 9 (         set f=!f:^00 (=!     ) else (         set f=!f:^0 (=!     )     set f=!f:^)=!     ren "%%a" "!f!" ) pause 

however, once run code, result:

enter image description here

so batch file isn't going through files "intuitively" windows explorer shows them. there way change this? or there better way rename these files altogether?

this uses different approach:

@echo off cd c:\folder setlocal enabledelayedexpansion  set /a count=0, remove=2  /f "delims=(" %%a in ('dir /b *.jpg') (     set /a count+=1     echo !count!     set "f=%%a"     if !count! equ 10 set "remove=3"     /f %%r in ("!remove!") set "f=!f:~0,-%%r!"     ren "%%a" "!f!!count!.jpg" ) pause 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -