I have a directories with .MP3 files which I'd like to change the extensions to .mp3. What's the easiest way to do this? I'm think something along the lines of:find /RootPath -type f -iname *.mp3 -exec mv {} sed s/.*MP3/\1.mp3/ \; ...though I know that isn't quite right. :) The substitution isn't correct and I'm not sure how to use both a mv and a sed command with -exec in find.Would I need a bash script for this?
How to clean up file extensions?
shell;find;rename
Here is one way to do this in Bash:for i in *; do [ ${i/%MP3/mp3} != $i ] && echo $i ${i/%MP3/mp3}; doneI've used echo here so the command itself doesn't do anything but print pairs of files names.  If that list represents the changes you want to make, then you can change echo to something like mv -i -- which will then move your files (and prompt you before overwriting).  Brief Explanation:The for iterates through every file matched by *.  Then, we determine if the extension is already lowercase, if it is we move on, if it isn't, we proceed to move it (or echo it, as the case may be).  This uses Bash's built in string operations which you can read about here: http://tldp.org/LDP/abs/html/string-manipulation.html