If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Changing multiple file names at once in DOS
How do I add a 'p' to the end of all files within a
folder in DOS. I also need to be able to remove the 'p' at a later date with one command string. |
#2
|
|||
|
|||
On Wed, 1 Dec 2004 13:59:44 -0500, "Tom"
scribbled some thoughts: How do I add a 'p' to the end of all files within a folder in DOS. I also need to be able to remove the 'p' at a later date with one command string. Be a whole lot easier if you said change the extension: REN *.dat *.old Then when done/after that time limit, assuming there are no other files adversely affected: REN **.old *.dat -- Sincerely, | NOTE: Best viewed in a fixed pitch font | (©) (©) Andrew H. Carter | ------ooo--(_)--ooo------ d(-_-)b | /// \\\ |
#3
|
|||
|
|||
If I was doing this I would create a small VB program. Note that you can't
strictly do what you are trying to do, as there is no way of knowing whether a p at the end of a filename was placed there by the renaming (and should be removed) or was there is the first place (and should not be removed). If your file names have a limited range of lengths then you can create a small batch file, one line for each length of filename, eg ADD_P.BAT REN ???????.* ???????p.* REN ??????.* ??????p.* etc DEL_P.BAT REN ???????p.* ???????.* REN ??????p.* ??????.* etc -- Jeff Richards MS MVP (Windows - Shell/User) "Tom" wrote in message ... How do I add a 'p' to the end of all files within a folder in DOS. I also need to be able to remove the 'p' at a later date with one command string. |
#4
|
|||
|
|||
Jeff,
I think it must be: DEL_P.BAT REN ?p.* ?.* REN ??p.* ??.* (etc) REN ???????p.* ???????.* i.e. the shorter names have to precede the longer ones (in contrast to ADD_P.BAT). If the names with the spaces are possible -- the double quotes are needed in the both batches. -- MM -- Original message: -- Jeff Richards wrote: If I was doing this I would create a small VB program. Note that you can't strictly do what you are trying to do, as there is no way of knowing whether a p at the end of a filename was placed there by the renaming (and should be removed) or was there is the first place (and should not be removed). If your file names have a limited range of lengths then you can create a small batch file, one line for each length of filename, eg ADD_P.BAT REN ???????.* ???????p.* REN ??????.* ??????p.* etc DEL_P.BAT REN ???????p.* ???????.* REN ??????p.* ??????.* etc |
#5
|
|||
|
|||
The two processes have different effects, for sure, but that was partly my
point. It's a very primitive procedure, that needs to be specified in a lot more detail. For instance, there's no way of telling whether ADD_P has been run more than once, and therefore there's no way to decide which form of the DEL_P should be used. And if long filenames could be involved then my suggestion becomes unmanageable. Some of these issues could be addressed by a custom-written application, but it's still a kludge. Perhaps I should have said "If I was doing this I wouldn't do it like this!" -- Jeff Richards MS MVP (Windows - Shell/User) MM wrote in message ... Jeff, I think it must be: DEL_P.BAT REN ?p.* ?.* REN ??p.* ??.* (etc) REN ???????p.* ???????.* i.e. the shorter names have to precede the longer ones (in contrast to ADD_P.BAT). If the names with the spaces are possible -- the double quotes are needed in the both batches. -- MM -- Original message: -- Jeff Richards wrote: If I was doing this I would create a small VB program. Note that you can't strictly do what you are trying to do, as there is no way of knowing whether a p at the end of a filename was placed there by the renaming (and should be removed) or was there is the first place (and should not be removed). If your file names have a limited range of lengths then you can create a small batch file, one line for each length of filename, eg ADD_P.BAT REN ???????.* ???????p.* REN ??????.* ??????p.* etc DEL_P.BAT REN ???????p.* ???????.* REN ??????p.* ??????.* etc |
#6
|
|||
|
|||
On Wed, 1 Dec 2004 13:59:44 -0500, "Tom"
wrote: How do I add a 'p' to the end of all files within a folder in DOS. rename *.* *p.* -- Steve Hayes from Tshwane, South Africa http://www.geocities.com/Athens/7734/stevesig.htm E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk |
#7
|
|||
|
|||
You might be running an enhanced shell, because this command does not work
in a standard COMMAND.COM -- Jeff Richards MS MVP (Windows - Shell/User) "Steve Hayes" wrote in message ... On Wed, 1 Dec 2004 13:59:44 -0500, "Tom" wrote: snip rename *.* *p.* |
#8
|
|||
|
|||
On Fri, 3 Dec 2004 08:31:23 +1100, "Jeff Richards"
wrote: You might be running an enhanced shell, because this command does not work in a standard COMMAND.COM OK, this is what I tried. I created 2 files test1.tmp test2.tmp I typed rename test*.* test?p*.* That worked. -- Steve Hayes from Tshwane, South Africa http://www.geocities.com/Athens/7734/stevesig.htm E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk |
#9
|
|||
|
|||
Yes - but that's not quite what you suggested. The ? works as a single
character placeholder for a REN, but * doesn't work as a multi-character placeholder. -- Jeff Richards MS MVP (Windows - Shell/User) "Steve Hayes" wrote in message ... On Fri, 3 Dec 2004 08:31:23 +1100, "Jeff Richards" wrote: You might be running an enhanced shell, because this command does not work in a standard COMMAND.COM OK, this is what I tried. I created 2 files test1.tmp test2.tmp I typed rename test*.* test?p*.* That worked. -- Steve Hayes from Tshwane, South Africa http://www.geocities.com/Athens/7734/stevesig.htm E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
missing .dll file, windows won't load | greg | Setup & Installation | 3 | October 25th 04 09:45 PM |
Help! SE won't boot | Ken Knecht | Setup & Installation | 8 | October 2nd 04 01:55 PM |
Folder Named [C:\Program] Opens Automatically on Start | Ted Belben | General | 2 | September 16th 04 11:39 PM |
Please help! Display settings !! | Mitzi | Monitors & Displays | 12 | July 11th 04 05:19 AM |
Win98SE - problem with USB printer | HBYardSale | Software & Applications | 2 | June 20th 04 06:27 PM |