storing bits of the internet away for a rainy day

Posts Tagged ‘scripting’

Bash Scripting: Mp3 Renaming

Posted by squirreling on May 11, 2008

Just wrote a quick script to rename a bunch of mp3 files, removing the site name from the file.  (ie from “23 Glory [www.site.com].mp3” to “23 Glory.mp3“.  This uses the ${var%remove-from-end} bash variable manipulation.

for file in *.mp3
       mv "$file" "${file%\[www.site.com\].mp3}.mp3"

See the Advanced Variable Manipulation in Mendel Cooper’s very useful Bash Scripting Guide.

Posted in Uncategorized | Tagged: , , , , | Leave a Comment »