Anna's notepad

Remove string from all filenames using bash

I decided to add this to my online notepad because I use it a lot. When ripping CDs, the tracks often come out with the artist name and album title in every single filename, which I don't want. Instead of editing them all one-by-one, I looked into how to use bash to do it for me. This command will affect all the files in whichever folder you're currently in (inside bash).

for file in *; do mv "${file}" "${file/STRING_TO_REMOVE /}"; done

#bash shell