Page 1 of 1

Batch Rename of files in a folder

Posted: 10 May 2021 11:01
by pillaisg
Hi All..

I am having some files nearly 2000 in nos. in a particular folder. I just need to replace some portion. Is it possible that I can do it instantaneously.. if so please guide....

Details are furnished below.

Old file Name :
P12478-12-71-41-1781-01.dwg
P12478-12-71-41-1781-02.dwg
P12478-12-71-41-1781-03.dwg

New File Name :
P12478-12-71-41-1961-01.dwg
P12478-12-71-41-1961-02.dwg
P12478-12-71-41-1961-03.dwg

Can any body guide me with easy options.

Re: Batch Rename of files in a folder

Posted: 10 May 2021 12:39
by Squashman
You were pretty much given the code in your previous question from 6 years ago.

Code: Select all

FOR /F "tokens=1-6 delims=-" %%A IN ('dir /a-d /b *.dwg') DO rename "%%A-%%B-%%C-%%D-%%E-%%F"  "%%A-%%B-%%C-%%D-1961-%%F"