how to rename

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

how to rename

#1 Post by Mohammad_Dos » 13 Jul 2012 03:16

how to rename all of files with the name "aaaa" in Hard drive "D" to "ssss"?

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: how to rename

#2 Post by Ed Dyreen » 13 Jul 2012 03:37

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

Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

Re: how to rename

#3 Post by Mohammad_Dos » 13 Jul 2012 04:29

it does not work!

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: how to rename

#4 Post by Ed Dyreen » 13 Jul 2012 05:27

'
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. . .

Squashman
Expert
Posts: 4471
Joined: 23 Dec 2011 13:59

Re: how to rename

#5 Post by Squashman » 13 Jul 2012 06:14

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.

Post Reply