Batch rename a whole series of folders
Moderator: DosItHelp
Batch rename a whole series of folders
I have several hundreds of folders, named ABCDxxxx (xxxx being a distinct number for each folder), all depending from the same mother directory, and I would like to convert them to WXYZxxxx (xxxx being the same number the original folder had). Is there any DOS or batch way of doing this?
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
**UNTESTED**
Code: Select all
@echo off
set "parentdir=c:\tmp"
cd /d "%parentdir%"
for /d %%a in (ABCD*) do (
set "currentdir=%%~a"
call move "%%~a" "WXYZ%%currentdir:~4,9999%%"
)