I have a directory with thousands of subdirectories that contain their own subdirectories that need to be renamed. I'm using a Windows 7 machine that I do not have Administrator rights for so I can't download a simple program to do this for me.
Right now I have a test directory C:\test
with a few subdirectories that have subdirectories named old
that I am trying to change to new
using a batch file.
Just to be clear I want the following:
C:\test\1\old C:\test\2\old C:\test\3\old
to become
C:\test\1\new C:\test\2\new C:\test\3\new
Thank you for any help you can provide.
Here's what I came up with quickly. I ran a quick test locally and it seemed to do what you're asking for:
@echo off
FOR /D %%D IN ("C:\test\*") DO CALL :RENAME %%D
:RENAME
SET CRITERIA=\old
FOR /D %%R IN (%1%CRITERIA%) DO RENAME %%R "new"
Save that to a bat file and give it a shot. Hopefully that helps.