Batch Script to rename files

December 13, 2010 at 07:43:51
Specs: Windows 7
I'm trying to rename about 1000 files that just have the date. They are all named 12-6-10 or 12-7-10. Each of them is inside a folder With a code for the product name. I'm trying to rename the file to contain the folder name in the filename as well. There are also a few folders that don't have this file and I'd hope it wouldn't mess up those files

Ex.
RD00176\12-6-10
I want to make RD00176\RD00176 12-6-10

I'd prefer a simple batch file.


See More: Batch Script to rename files

Report •


#1
December 13, 2010 at 09:27:11
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b/s/ad ..') do (
for /f "tokens=* delims= " %%i in ('dir/b/s/a-d "%%a"') do (
ren "%%a\%%~Ni" "%%~Na-%%~Ni"
)
)


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

M2


Report •

#2
December 14, 2010 at 10:38:37
You put a for in do inside of a for in do but what is the "tokens=* delims= ". Sorry, I'm trying to debug this it's saying that "the system can not find the file specified."

Report •

#3
December 15, 2010 at 02:49:46
Post your code.


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

M2


Report •
Related Solutions


Ask Question