Batch Rename of files in a folder

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
pillaisg
Posts: 4
Joined: 15 Nov 2015 08:44

Batch Rename of files in a folder

#1 Post by pillaisg » 10 May 2021 11:01

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.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Batch Rename of files in a folder

#2 Post by Squashman » 10 May 2021 12:39

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"

Post Reply