Computing.Net > Forums > Programming > Create a batch file to rename text

Create a batch file to rename text

Reply to Message Icon

Original Message
Name: Floyd4us
Date: November 22, 2006 at 05:15:23 Pacific
Subject: Create a batch file to rename text
OS: XP
CPU/Ram: Pen4/1GB
Model/Manufacturer: Dell
Comment:

I would like to create a batch file that will add an additional 1 to the front of an existing 8 digit text file,i.e...

11062169.txt-->111062169.txt
09524659.txt-->109524659.txt
65409995.txt-->165409995.txt

There are hundreds of files this will be used on and the digit added will always be a 1.

Anyone have any ideas?

Floyd4us


Report Offensive Message For Removal


Response Number 1
Name: RTAdams89
Date: November 22, 2006 at 05:50:20 Pacific
Reply: (edit)

Well if you don't mind using a program, try Bulk Rename Utility (just search Google for that, it's the first result).

-Ryan Adams
http://members.cox.net/rtadams89/


Report Offensive Follow Up For Removal

Response Number 2
Name: IVO
Date: November 22, 2006 at 06:05:55 Pacific
Reply: (edit)

You don't need a batch script, just type at prompt in the directory where files are stored

for /f %i in ('dir /b /a-d *.txt') do @ren %i 1%i

and you are done.


Report Offensive Follow Up For Removal

Response Number 3
Name: Floyd4us
Date: November 22, 2006 at 07:46:11 Pacific
Reply: (edit)

I tried to run the above line in the dos command promt and it tells me:

/f% was unexpected at this time

I am running in the right directory.

Floyd4us


Report Offensive Follow Up For Removal

Response Number 4
Name: Floyd4us
Date: November 22, 2006 at 07:51:02 Pacific
Reply: (edit)

Nevemind...I missed the space between the f and the %!!! Thanks it worked GREAT!

Floyd4us


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Create a batch file to rename text

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge