A Windows 98 & ME forum. Win98banter

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.

Go Back   Home » Win98banter forum » Windows 98 » Software & Applications
Site Map Home Authors List Search Today's Posts Mark Forums Read Web Partners

Changing multiple file names at once in DOS



 
 
Thread Tools Display Modes
  #1  
Old December 1st 04, 06:59 PM
Tom
external usenet poster
 
Posts: n/a
Default 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  
Old December 1st 04, 07:23 PM
Andrew H. Carter
external usenet poster
 
Posts: n/a
Default

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  
Old December 1st 04, 08:38 PM
Jeff Richards
external usenet poster
 
Posts: n/a
Default

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  
Old December 1st 04, 09:29 PM
MM
external usenet poster
 
Posts: n/a
Default

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  
Old December 1st 04, 10:29 PM
Jeff Richards
external usenet poster
 
Posts: n/a
Default

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  
Old December 2nd 04, 07:27 AM
Steve Hayes
external usenet poster
 
Posts: n/a
Default

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  
Old December 2nd 04, 09:31 PM
Jeff Richards
external usenet poster
 
Posts: n/a
Default

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  
Old December 3rd 04, 05:50 AM
Steve Hayes
external usenet poster
 
Posts: n/a
Default

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  
Old December 3rd 04, 06:48 AM
Jeff Richards
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 12:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Win98banter.
The comments are property of their posters.