Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'How a Rename Program Saves Time' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How a Rename Program Saves Time
Authored by: forman on Jul 13, '05 04:04:38AM
The reason is that one shouldn't just use "mv" is that it only operates on one file at a time. If you need to rename multiple files in a similar way a rename program or script can save a lot of time. For instance, I was taking screenshots tonight using Apple Remote Desktop. I had to add on a numerical suffix to each snapshot as I took it and later I wanted to clean up the names. What I had was:
Apple Remote Desktop1.tif
Apple Remote Desktop2.tif
...
Apple Remote Desktop14.tif
Apple Remote Desktop15.tif
What I did was the following:
ren-regexp "s/Apple Remote Desktop/2005-07-12-RD-/" *tif
ren-regexp "s/RD-/RD-0/" *tif
ren-regexp 's/RD-\d(\d\d)/RD-$1/' *tif
Actually, my program ren-regexp can take all those regular expressions on a single line:
ren-regexp "s/Apple Remote Desktop/2005-07-12-RD-/" "s/RD-/RD-0/" 's/RD-\d(\d\d)/RD-$1/' *tif
What I was left with was:
2005-07-12-RD-01.tif
2005-07-12-RD-02.tif
...
2005-07-12-RD-14.tif
2005-07-12-RD-15.tif
I typed 94 characters with the above command and it saved me 30 mouse clicks and 270 characters and that's just for 15 files. Imagine how much effort you could save if you had hundreds of images that you need to rename.

Michael.

[ Reply to This | # ]