Page 1 of 1

Adding Serial Number while rename files through MS-Dos

Posted: 02 Dec 2021 23:39
by Asim
Respected All!
A folder contained 45 files and I want to rename all these files by adding serial number in the start of each file like

1. BirthDayShots
2. BirthDayShots
3. BirthDayShots
.
.
.
.
.
45. BirthDayShots

Looking forward

Re: Adding Serial Number while rename files through MS-Dos

Posted: 03 Dec 2021 08:41
by AR Coding
Is this what you mean?

Code: Select all

Setlocal EnableDelayedExpansion 
set i=0
set "filepath=C:\Folder\of\files"
for /R %filepath% %%a in (*.*) do (
 set /a i+=1
 ren "%%~dpnxa" "!i!. %%~nxa"
)

Re: Adding Serial Number while rename files through MS-Dos

Posted: 06 Dec 2021 01:10
by Asim
Thank You! Serial Number added successfully but I also want to change file(s) names as well

Re: Adding Serial Number while rename files through MS-Dos

Posted: 06 Dec 2021 17:09
by AR Coding
to what?

Re: Adding Serial Number while rename files through MS-Dos

Posted: 06 Dec 2021 20:57
by Squashman
Asim,
Your technical specifications for what you wanted to accomplish was extremely lacking. If I was given this little information I would be giving this back to my business analysts to rewrite it. Please be more specific with what you want to accomplish. Provide complete input and output examples.