Bulk DOS rename?

G

Glen Millar

Hi,

It is possible in DOS to bulk rename extensions. For example, I can type in:
ren *-*.txt **.xls, and it will rename all txt files to an xls extension in
the directory I am in. But we just received 1500 files with a "-" dash in
the middle of the file name. Is there someway to rename these in a bulk
fashion to and underscore "_"? Our model can't handle dashes as it considers
it an integer.

--

Regards,

Glen Millar
Microsoft PPT MVP
http://www.powerpointworkbench.com/
Please tell us your ppt version, and get back to us here
Remove spaces from signature
Posted to news://msnews.microsoft.com
 
M

Michael Koerner

Glen,

I use a little utility called rename-it. you can find it here
http://www.scp-solutions.com/renameit.html

It allows you to rename anyway you want .



Hi,

It is possible in DOS to bulk rename extensions. For example, I can type in:
ren *-*.txt **.xls, and it will rename all txt files to an xls extension in
the directory I am in. But we just received 1500 files with a "-" dash in
the middle of the file name. Is there someway to rename these in a bulk
fashion to and underscore "_"? Our model can't handle dashes as it considers
it an integer.

--

Regards,

Glen Millar
Microsoft PPT MVP
http://www.powerpointworkbench.com/
Please tell us your ppt version, and get back to us here
Remove spaces from signature
Posted to news://msnews.microsoft.com
 
G

Glen Millar

Michael,

Excellent! I'm onto it. Thanks.

By the way, I thought of you last week when I was digging the car out of the
snow ;-)

--

Regards,

Glen Millar
Microsoft PPT MVP
http://www.powerpointworkbench.com/
Please tell us your ppt version, and get back to us here
Remove spaces from signature
Posted to news://msnews.microsoft.com
 
M

Michael Koerner

Great, and I'll keep you in mind the next time I hear about mud anywhere in the
world <g>



Michael,

Excellent! I'm onto it. Thanks.

By the way, I thought of you last week when I was digging the car out of the
snow ;-)

--

Regards,

Glen Millar
Microsoft PPT MVP
http://www.powerpointworkbench.com/
Please tell us your ppt version, and get back to us here
Remove spaces from signature
Posted to news://msnews.microsoft.com
 
S

Steve Rindsberg

Hi,

It is possible in DOS to bulk rename extensions. For example, I can type in:
ren *-*.txt **.xls, and it will rename all txt files to an xls extension in
the directory I am in. But we just received 1500 files with a "-" dash in
the middle of the file name. Is there someway to rename these in a bulk
fashion to and underscore "_"? Our model can't handle dashes as it considers
it an integer.

If Michael's suggested utility doesn't do it, it should be fairly simple to
cobble up something in VBA.

You already know how to use Dir$(spec) and Dir to loop through a bunch of
files; you could do something like:

Dim strFileSpec as String
Dim strThisFile as string

strFileSpec = "C:\Glenns\Weirdly\Named\Files\*.XLS"

' Do any files match spec?
strThisFile = Dir$(strFileSpec)
While Len(strThisFile) > 0
' Got one - does it have a "-" character? Improve it:
name strThisFile as Replace(strThisFile, "-", "_")
' get next file, if any
strThisFile = Dir
Wend

CAUTION: Run this only on a test folder, eh? OffTopOfHead coding not to be
trusted on your only copy of anything.

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
J

John O

Is the dash in the same place in each filename?

REN ???-???.* ???_???.*

If the dash is in several locations you might re-run the command with the
dash elsewhere. BTW, *copy* the files to another location then do the
rename, just in case there's a mistake... ;-)

-John O
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top