DOS Renaming Batch File

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

DOS Renaming Batch File

Post by Grim... »

I'm well aware the this would be easy to do in a quick perl script, but all I have access to is DOS, so it's got to be a batch script (if it can be).

Basically, I have a folder (let's call it c:/folder) with a load of images in, named something like
"7556 - my house.jpg" or
"0451 - big hill.jpg" etc.

What I'd like to do is have a batch file take away the first seven characters of each filename (ie. the number, dash and the spaces) in the folder, so I'd be left with
"my house.jpg"" and
"big hill.jpg"

This page may contain clues but I don't know how to plug that into a RENAME function.
timclaason
Forum Commoner
Posts: 77
Joined: Tue Dec 16, 2003 9:06 am
Location: WI

Post by timclaason »

You could try:

Code: Select all

ren ???????*.jpg *.jpg
Make sure to test it in a dummy directory before going live with it
Post Reply