Rename problems....
Searched many of the threads here trying to figure out how to use rename function, also checked the man and info pages, to no avail.
I've got a folder with plenty of mp3 tracks. The problem is many of them have multiple spaces in the name and the extension is in CAPS. So I thought I'd start little by replacing all extensions to lower case. Following the rename example from the man pages, I tried this, but it didn't work Code:
rename .MP3 .mp3 *.MP3 Code:
rename 's/\.MP3/\.mp3/g' *.MP3 Code:
ls -R | sed 's/\.MP3/\.mp3/g' Thanks, karnaf p.s. Running openSUSE 10.2 -> bash 3.1.17(1) |
Your example works without a problem here, with or without spaces in the file names. Bash 3.2.15(2) on Slackware, rename from util-linux 2.12r.
|
The problem: there are two seperate rename commands, one from perl, another more basic. The first example is the more basic rename command from util-linux i think, the second is for the perl version. So, the first question, what rename command do you have installed (as they are not compatible)?
Also, what do you mean by it dident work? Any error messages to show? And i assume are you already in the same directory as the files you want renamed. |
Using rename from util-linux-2.12r, so I guess we're dealing with the basic one.
Didn't work == no error msgs, just acting as if it has worked but no file changes made. Of course I'm in the directory and have permission to rename files there. I've tried the more complex bash script Code:
for OLD_FILE in *.MP3 Cheers! karnaf |
I don't know why it won't work for you, but another solution:
for file in *.MP3; do mv ${file} ${file//.MP3/.mp3}; done |
Code:
for file in *.MP3; do mv ${file} ${file//.MP3/.mp3}; done I ended up editing my above script to do the job Code:
for OLD_FILE in *.MP3 |
All times are GMT -5. The time now is 09:18 AM. |