How to set up a batch file to rename files

Microsoft Microsoft windows xp pro full...
December 29, 2010 at 11:54:41
Specs: Windows XP
I have a large database of files which are .pdf, .doc and .xls. I want to set up a batch file to rename each item with the prefix wtc_it_filename.fileextension

I have tried:

for %%F in (*.pdf *.doc*.xls) do ren "%%F" "%%wtc_it_*.*"

this did not work. Any ideas?


See More: How to set up a batch file to rename files

Report •


#1
December 29, 2010 at 12:25:17
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir /b *.pdf *.doc *.xls') do (
ren "%%a" "wtc_it_%%a"
)


=====================================
Life is too important to be taken seriously.

M2


Report •

#2
January 5, 2011 at 07:42:16
That worked well. What if I want the changes made in all the subfolders as well? Thanks

Report •

#3
January 6, 2011 at 02:49:33
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b/s *.pdf *.doc *.xls') do (
ren "%%a" "wtc_it_%%~NXa"
)


=====================================
Life is too important to be taken seriously.

M2


Report •
Related Solutions


Ask Question