Hi all, first time poster here... the short version is I have a folder auto-downloaded to a server each week. The original folder's location & name: "Y:\MrMaster\House of Hair (3 Hour) AIRS SUNDAY ONLY 03.23.14 5 for KSNQ-FM only"
I want to rename the folder using a batch file. New name needs to be "Y:\MrMaster\HOUSE" (sans quotes of course)
Two issues I'm experiencing. 1) Can't accomplish the rename even one time, and 2) The date on the auto-downloaded folder changes each week. Everything else on the folder's name is the same.
The server is the Y drive.
The following code does not accomplish this, and I'm wondering what I need to change:
cd y:\mrmaster
ren y:\mrmaster\*house* HOUSE
Any thoughts?
Renaming issue
Moderator: DosItHelp
Re: Renaming issue
Wildcards cannot be used when renaming folders. They work fine for file names, but never for folder names. See http://superuser.com/q/475874/109090 for rules on how Windows REN command interprets wildcards.
I suggest the following for renaming your folder (assuming there is only one folder that matches the *house* mask).
Edit: added the critical /D option, and also added the path
Dave Benham
I suggest the following for renaming your folder (assuming there is only one folder that matches the *house* mask).
Edit: added the critical /D option, and also added the path
Code: Select all
for /d %%F in (y:\mrmaster\*house*) do ren "%%F" HOUSE
Dave Benham