Page 1 of 1

how to rename

Posted: 13 Jul 2012 03:16
by Mohammad_Dos
how to rename all of files with the name "aaaa" in Hard drive "D" to "ssss"?

Re: how to rename

Posted: 13 Jul 2012 03:37
by Ed Dyreen
Mohammad_Dos wrote:how to rename all of files with the name "aaaa" in Hard drive "D" to "ssss"?
There is nothing like a Hard drive "D", never heard of it sorry.

If however you like to rename all files on drive 'D:' named 'aaaa' to 'ssss' u can use

Code: Select all

@echo off

for /d /r %%? in (

       "aaaa"

) do   echo.ren "%%~?" "ssss"

pause
exit

Re: how to rename

Posted: 13 Jul 2012 04:29
by Mohammad_Dos
it does not work!

Re: how to rename

Posted: 13 Jul 2012 05:27
by Ed Dyreen
'
Sorry, my mistake

Code: Select all

@echo off

for /r %%? in (

       aaaa

) do   if exist "%%~dp?%%~nx?" (

       echo.ren "%%~dp?%%~nx?" "ssss"
)

pause
exit

Code: Select all

ren "..\aaaa" "ssss"
ren "..\Nieuwe map\aaaa" "ssss"
Druk op een toets om door te gaan. . .

Re: how to rename

Posted: 13 Jul 2012 06:14
by Squashman
Mohammad_Dos wrote:it does not work!

You could try debugging it yourself or attempting to write the code yourself instead of people giving you the fish like they have for the past two years.

I just have to ask. Are you putting all of this code you are given onto your website. I looked at your website and translated the main page and see you have several tutorials on creating batch files. If you are doing that, are you giving credit to the people here who have been helping you with the code and linking back to the webpage as a source of your articles.