| « Newport... | Another reminder for me... » |
Changing filename extensions
I was converting some mp3s into a format that I could use on my iPhone using the info in this page:
http://theappleblog.com/2008/08/07/free-custom-iphone-ringtones-using-only-itunes/
Then I needed to rename the files to m4r’s.
Here’s the shell script I used, as the files had spaces in their names
#!/bin/sh
# replace ‘ ‘ with ‘_’
for e in *; do mv “$e” “`echo $e | sed -e ’s/\ /_/g’`"; done
# rename the files
ls *.m4a | sed -e “s/^\(.*\)\.m4a$/\1\.m4a \1\.m4r/g” | xargs -n 2 mv -f
# replace the ‘_’ with ‘ ‘
for e in *; do mv “$e” “`echo $e | sed -e ’s/\_/ /g’`"; done