Renaming multiple files at a time

This command took me 20 minutes to find. Let's hope that this helps someone and me next time I need to do something similar.

find . -name '*foo*' -type f -exec bash -c 'mv "$1" "${1/foo/bar}"' -- {} \;

Tags: