Whenever I convert from one file format to another (for example, flac → ogg), I use find and ffmpeg. However, that leaves me with files like song_1.flac.ogg which is really annoying. Since my music library is distributed among multiple folders, it would have been annoying to use Thunar's Bulk Renamer. That's why I put together the following script:
#!/bin/bash
find -name *.$1 | while read f
do
mv ./"$f" "${f%$1}$2"
done
echo "Successful!"
(Yes, the last line is completely extraneous and completely meaningless in the context of error messages
)
The script takes two arguments - the first is the extension you want to remove and the second is the extension you want to replace it with. For example:
To rename a bunch of files like song_1.flac.ogg, I'd call the script like this:
rename.sh flac.ogg ogg
Notice that I did not include a leading dot for either the first or second arguments.
That's it! Enjoy!