how to rename many similar files?
Hello,
I have a list of files like: IMG_0052.jpg IMG_0053.jpg IMG_0054.jpg IMG_0055.jpg IMG_0056.jpg IMG_0057.jpg IMG_0058.jpg IMG_0059.jpg (.....) IMG_0365.jpg and I need to rename them to L_000.jpg L_001.jpg L_002.jpg L_003.jpg (...) How do I do that in an economical way? (I have already tried "mv" and "rename" but I did not find out how to change the consecutive numbering) Thanks for help Stranger |
Code:
|
Quote:
although it generates lines like mv IMG_0052.jpg L__0052.jpg mv IMG_0053.jpg L__0053.jpg mv IMG_0054.jpg L__0054.jpg mv IMG_0055.jpg L__0055.jpg mv IMG_0056.jpg L__0056.jpg (...) but when I do ls -l the filenames have remained unchanged :confused:. I still get -rwxrwxrwx 1 raimoed users 181075 2005-03-24 10:19 IMG_0052.JPG -rwxrwxrwx 1 raimoed users 181075 2005-03-24 10:19 IMG_0053.JPG -rwxrwxrwx 1 raimoed users 165190 2005-03-24 10:19 IMG_0054.JPG -rwxrwxrwx 1 raimoed users 161017 2005-03-24 10:20 IMG_0055.JPG -rwxrwxrwx 1 raimoed users 162929 2005-03-24 10:20 IMG_0056.JPG -rwxrwxrwx 1 raimoed users 162305 2005-03-24 10:21 IMG_0057.JPG -rwxrwxrwx 1 raimoed users 161976 2005-03-24 10:21 IMG_0058.JPG (...) When I execute manually mv IMG_0053.jpg L__0053.jpg it does work and will change the filename as ecpected. I also got this with the command Code:
rename IMG_ L_ IMG* |
Try this...
Code:
count=1; |
Thanks, that works fine and saves me a lot of work:)
|
mvb shell script (bash or sh) file renaming utility
Hello--
If you like, you could try my shell script mvb, which I wrote expressly to make it easy to rename a lot of files at once. mvb has a homepage a icewalkers.com (I can't post the URL because I have not yet posted 3 messages to linuxquestions.org, so search for "mvb" at icewalkers) :) best wishes, Steve Doonan New Mexico US |
Actually, Billy used the echo cmd so you can see what the generated cmd would/should be, but without it actually doing anything.
This is a safety measure so you can be sure what will happen before you use it for real. Remove the 'echo' cmd and you'll be good to go. |
Code:
rename IMG_0 L_ *jpg Cheers, Tink |
All times are GMT -5. The time now is 08:03 PM. |