I'd like to rename a large number of files within a folder on a WinXP system, preferably using a batch file.
The files are currently named like this:
Vacation2010 001.jpg
Vacation2010 002.jpg
Vacation2010 003.jpg
And I'd like to change them to:
December 001.jpg
December 002.jpg
December 003.jpg
How can I perform this operation??
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
SET old=Vacation2010
SET new=December
for /f "tokens=*" %%f in ('dir /b *.jpg') do (
SET newname=%%f
SET newname=!newname:%old%=%new%!
move "%%f" "!newname!"
)
What this does is it loops over all .jpg files in the folder where the batch file is located and replaces the Vacation2010 with December inside the filenames.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With