Recursively find/replace of a string in directories and file names

find

find . -depth -name '*test*' -execdir bash -c 'mv -v "$1" "${1//foo/bar}"' _ {} \;
click the source code to copy install find on any operating system with command-not-found.com