Hello,
I would need some help with writing the .bat file that renames all files with same extension (let's say .jpg) in one folder as numeric row.
The original files are:
somefile.jpg
anotherfile.jpg
onemorefile.jpg
. . . . .
(and so on)
And the result supposed to be:
1.jpg
2.jpg
3.jpg
. . .
(etc)
Any ideas?
Thank you
Rename multiple files
Moderator: DosItHelp
-
- Posts: 36
- Joined: 17 Jul 2008 07:37
Code: Select all
SETLOCAL
set filecount=1
for /f %%a in ('dir /on /b *.jpg') do (call :rename %%a)
GOTO :EOF
:rename
ren %1 %filecount%.jpg
set /a filecount+=1
GOTO:EOF
This will sort by filename (dir /on) - run dir /? for other options
-
- Posts: 6
- Joined: 17 Jun 2009 20:17
- Location: http://vietdzung.net
- Contact: