PDA

View Full Version : Batch Rename


BWiley
1st of March 2003 (Sat), 22:23
Sometimes when I'm processing images for a client in Breezebrowser I insert in the filename the size of the print to be made, like this:

100-0004_5x7.tif

But before I can send the order to my photo processor, I still need to change 2 things:

Remove the "100" at the beginning and insert a 7-digit order number that corresponds to the form of my photo processor,

Renumber the "0004" so all the files are consecutive,

and also leave the "_5x7" on the name (unchanged).

My goal is to end up with this:

2473575-0001_5x7.tif

I figured out how to insert the 7 digit number at the beginning (Custom Function 1), and I use %n to set the sequence number, but I can't figure out how to leave the picture size that I previously put in the file name. The picture size varies from file to file.

Any ideas?

Thanks, Bill

SkipD
2nd of March 2003 (Sun), 08:18
Using good old DOS commands, that task is easy:

REN 100-000*.* 1234567-00*.*

Every filename that starts with 100-000xxxxxx will wind up being 1234567-00xxxxxx (the xx's remain the same from old to new).

There are many other variations of this that you can use as well, depending on your structure and needs. I showed the * wildcard character above which means "everything", and can represent any number of characters. If you want a very structured version, you can use the ? wildcard to represent each character. The same thing above for a filename formatted like "100-0004_5x7.tif" might look like this:

REN 100-00??_5X7.tif 1234567-00??_5X7.tif

I just tried this using the command prompt environment in Windows 2000 Pro, and it worked even for filenames that are longer than the 8x3 DOS format.

You should be able to write a batch file to do the same things, but if there are variations each time you do it the batch file doesn't make much sense.

BWiley
2nd of March 2003 (Sun), 21:50
Thanks for the tip, Skip. I forgot that DOS commands ever existed. This will be a good way to simplify a task I've wondered about.

Thanks again.