Computing.Net > Forums > Disk Operating System > a batch file to rename certain files

a batch file to rename certain files

Reply to Message Icon

Original Message
Name: Brad
Date: June 4, 2002 at 13:07:16 Pacific
Subject: a batch file to rename certain files
Comment:

Maybe someone on this site can help me.
I need a batch file to rename files.
The way it needs to work is:
you open the batch file and it asks you to pick the kind of files you want renamed,
(lets say ex020604.*) and it will then ask what prefix do you want put on:
the user can enter LAS
when the user hits enter,
all files starting with ex and whatever parts of the dated file they choose, get renamed, so that the ex comes off and the new title comes on it.
I am really hoping someone can help me out.
Please email me if you can help at all.
Thank you in advance.


Report Offensive Message For Removal

Response Number 1
Name: cup
Date: June 4, 2002 at 23:40:45 Pacific
Subject: a batch file to rename certain files
Reply: (edit)

Not so easy in DOS - it doesn't have the basename command like unix. Does it have to be DOS batch? Could you use WSH or CSH?


Report Offensive Follow Up For Removal

Response Number 2
Name: cup
Date: June 5, 2002 at 08:41:58 Pacific
Subject: a batch file to rename certain files
Reply: (edit)

Have a look in home7.inet.tele.dk/batfiles
There may be a script there that you can use.


Report Offensive Follow Up For Removal

Response Number 3
Name: Emma
Date: June 6, 2002 at 09:47:29 Pacific
Subject: a batch file to rename certain files
Reply: (edit)

I sure could use the answer to Brad's question. I need to parse some input, and read the filename, but ignore the extension. If anyone knows how...

Thanks,

Emma


Report Offensive Follow Up For Removal

Response Number 4
Name: chris
Date: June 7, 2002 at 00:27:29 Pacific
Subject: a batch file to rename certain files
Reply: (edit)

All these kind of probs can be sorted very easily and quickly using a copy of QuickBasic. I can't beleive some of the batch files I see created to do these small jobs. Some batch files have hundreds of lines of code, whereas the same small jobs (as you've all requested above) can be done, literally, with just 3-4 lines of QBasic code.

Qbasic is downloadable from a number of sites. For those who've never programmed in basic, please don't panic. You only need to know a few of the string commands + the standard file in/out commands. Equivelant to reading just 6-8 pages of a 600 page manual....

However, there is one big limitation when using QBasic and that is it will ONLY handle Dos 8.3 filenames. I think some of the other flavours of Dos Basic (Powerbasic?) can handle long filenames. Or, of course, you can stay in windows and use Visual Basic.


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: a batch file to rename certain files

Comments:

 


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