Back when I first switched from the Z-System (an enhanced version of CP/M) to MS-DOS and Windows, I immediately upgraded my COMMAND.COM with 4DOS, a replacement command processor for MS-DOS. The company that makes 4DOS and 4WIN had a lot of input from Jay Sage, one of the Z-System gurus. Because of this, 4DOS enhanced MS-DOS in many of the same ways that ZCPR improved CP/M. This definitely made the necessary but difficult transition easier for me.
One of the things I found myself needing to do was rename files downloaded from the Web into a common pattern, to bring some sort of order out of chaos. If I downloaded a lot of pictures of penguins (for example), I might want to rename them peng0001.jpg, peng0002.jpg, etc. Or if I scanned a bunch of my old SCA pictures and then decided all the pictures from an event on 3/12/1978 should have a common name, I might want to rename them 78312001.jpg, 78312002.jpg, 78312003.jpg, etc.
Renaming each picture by clicking on it, etc. in Windows was definitely out! Renaming one at the 4DOS command line, then recalling the command, editing it, and re-running it was a little better, but still tedious. Writing the command in a batch file, cutting it and pasting it, and then going down through the lines changing the parts was a little bit better, as long as the original file names weren't too different. But Something Had To Be Done.
In the end I learned 4DOS's enhanced batch-file language and wrote a batch file called NUMREN.BAT. If you typed NUMREN without parameters, you got a short message telling you how it worked. Otherwise the syntax was:
So if you typed "NUMREN *.jpg 78312 1 .jpg", all the JPG files in the current directory would get renamed to 783121.jpg, 783122.jpg, etc. If there turned out to be 125 of them, you could then type "NUMREN 78312?.jpg 7831200 1 .jpg" to turn 783121.jpg to 78312001.jpg, 783122.jpg to 78312002.jpg, etc., and "NUMREN 78312??.jpg 783120 10 .jpg" to turn 7831210.jpg to 78312010.jpg, 7831211.jpg to 78312011.jpg, etc. Thus in only three commands you'd have renamed up to 999 files, and the second one could be executed by recalling and editing the first one, and the third one by recalling and editing either the first or the second.
Moving forward to this year, I'm all but completely switched over to Linux and happy not to be making Bill Gates any richer. One of the last things I'm using Windows for is running Windows 98 under Win4Lin so that I can still use NUMREN. But if I could write NUMREN in 4DOS batch-processing language, I can certainly replace it in something that runs under Linux.
The Perl scripting language turned out to be a good choice for this, not only because it's fairly simple, but because there are tons of tutorials and message boards out on the Web, and also because versions of Perl run on Windows and Macintosh as well as Linux. With a little effort, I wrote a Perl script called NR. To see it, click on the link at the end of the previous sentence. To download it to your own computer, just save it to a location on your system.
NR works exactly the same as NUMREN did. To run it, you may have to give it a file extension of .PL if you're running Windows. Make sure you have a version of Perl running on your computer; if you're running Linux you can be pretty sure you do, but if you're using Windows or a Macintosh you might have to get a copy from somewhere. Don't forget to store NR in a directory on your path, so that your computer can find it when you call for it, and if you're running Linux, don't forget to use CHMOD to make it executable ("chmod u+x nr").
Good luck, and have fun with it! Note that I don't guarantee anything, and if you mess up your files, I assume no responsibility and will accept no blame. I've been using this script for a month now with no problems of any kind, but I can't promise you won't have any problems on your system, or that you won't make any mistakes. I'm making this available as a public service, nothing more or less.