rename a folder with unknown name via cmd

March 21, 2011 at 14:57:11
Specs: Windows 7
How can I rename a directory with unknown name (without knowing folder's name) through CMD in windows (7) ?
Or rename all subfolders of a folder or rename a folder that we know just a part of its name like "hello" at the last of folder's name?

See More: rename a folder with unknown name via cmd

Report •

March 21, 2011 at 15:02:23
The computer can not read your mind. You have to know what you want to rename even if it is a part of the name or even something that is in the folder. Other wise you have to ask the user a question as to the name.

Can you provide one of these like a partial name...

ren New* Old*

The * means any folders that start with the name new so like NewFolder will be renamed OldFolder and so on.

Or if there is a file that will exist in the folder that we can find. Something.

Report •

March 21, 2011 at 15:14:26
i tested this command and the error "The syntax of the command is incorrect" occurs.
and i know just the last part of folder's name.

Report •

March 22, 2011 at 10:22:28
What is the command you used?

If you know the last part of the file then you put the star in front like...

ren *oldfolder *newfolder

but if you give us more like the name of the folder you are trying to change.

Report •

Related Solutions

March 22, 2011 at 13:46:16
Thanks ace_omega.
I want to rename folder named " 12345678.test " but i just know the last part of name " .test " .
I used " ren(also rename) *.test newname.test ".
and even i tested ren(also rename) *test *renamed " .
But i received above error,

Report •

March 22, 2011 at 16:25:41
You have dots in the folder names. You could try...

ren "*test" "newname.test"

I am not sure this will work thought.

Report •

March 23, 2011 at 08:02:33
Thanks for your answer.
I found answer :

when we don't know the directory name we can rename it with command "for" like below :

for /d %a in ("C:\folderpath\*") do rename
%a newname
and we can do more things with "for" command.


Report •

Ask Question