I thought it would.foxidrive wrote:Samir wrote:All the directories are just in 1 level deep, so there's no tree traversing needed per se.
Yep, ta. Saw that earlier.
My code still works for a bunch of folders that are within a single folder.

Moderator: DosItHelp
I thought it would.foxidrive wrote:Samir wrote:All the directories are just in 1 level deep, so there's no tree traversing needed per se.
Yep, ta. Saw that earlier.
My code still works for a bunch of folders that are within a single folder.
Code: Select all
@echo off
setlocal enableDelayedExpansion
set m=0
for %%A in (
JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
) do for /d %%F in (????-%%A) do (
set /a m+=1
set "mm=0!m!"
[b] set "year=%%F"
set "yyyy=!year:~0,4!"
echo ren %%F "!yyyy!-!mm:~-2!"[/b]
)
dbenham wrote:Both of these methods are untested, but unless I have made a silly error, they should work![]()
Pure batch: DohDoes not work because wildcard not allowed in REN targe name when renaming folders
Code: Select all
@echo off
setlocal enableDelayedExpansion
set m=0
for %%A in (
JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
) do for /d %%F in (????-%%A) do (
set /a m+=1
set "mm=0!m!"
ren "%%F" "*-!mm:-2!"
)
Dave Benham
Code: Select all
@echo off
setlocal enableDelayedExpansion
set m=0
for %%A in (
JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
) do for /d %%F in (????-%%A) do (
set /a m+=1
set "mm=0!m!"
set "folder=%%F"
set yyyy=!folder:~0,4!
ren "%%F" "!yyyy!-!mm:~-2!"
)