using 4 year date on folder

May 14, 2010 at 06:45:13
Specs: Windows XP
I have a lot of folders that are named 10_date (i.e. 10_0403). I want them to be 2010_date (i.e. 2010_0403) I tried putting

Ren 10_* 2010_*

into a batch file, but it says syntax error. The reason I put it into a batch is because there will be folder "A" with say 20 folders named that way, then folder "B" with another 20, and so on for a couple hundred folders. I didn't want to click on each folder to change it one at a time, so I was just going to copy it into each folder, run, and move it to the next. I also don't want to change older folders (with 09_ or 08_) or filenames.

See More: using 4 year date on folder

Report •

May 14, 2010 at 11:53:25
If you are looking Rename all directories that fit a particular pattern or parameter you could use the following script:

For /F "tokens=1,2 Delims=_" %%A in ('dir /b /d *_*') Do Ren %%A_%%B 20%%A_%%B

Make sure the 'dir /b /d *_*' encompasses the directories you are looking to rename. The 20 will be added to the beginning of each directory(folder) returned by 'dir /b /d *_*'.

Report •

May 14, 2010 at 12:09:12
It worked. I thank you, and I'm sure a co-worker thanks you too.

Report •
Related Solutions

Ask Question