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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

a batch file to rename certain files

Reply to Message Icon

Name: Brad
Date: June 4, 2002 at 13:07:16 Pacific
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.



Sponsored Link
Ads by Google

Response Number 1
Name: cup
Date: June 4, 2002 at 23:40:45 Pacific
Reply:

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?


0

Response Number 2
Name: cup
Date: June 5, 2002 at 08:41:58 Pacific
Reply:

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


0

Response Number 3
Name: Emma
Date: June 6, 2002 at 09:47:29 Pacific
Reply:

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


0

Response Number 4
Name: chris
Date: June 7, 2002 at 00:27:29 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: a batch file to rename certain files

creating a batch file to rename fil www.computing.net/answers/dos/creating-a-batch-file-to-rename-fil/15089.html

Using a batch file to name a file with the system date. www.computing.net/answers/dos/using-a-batch-file-to-name-a-file-with-the-system-date/3481.html

Going thro' every line in a batch file www.computing.net/answers/dos/going-thro-every-line-in-a-batch-file/5994.html