How to Rename Files and Folders in Bulk

IDEs and editors usually offer nice refactoring functionalities but renaming files and folders in batch still feels like a hard task.

Here is a bash command to find each occurrence of ‘foo’ and replace it with ‘bar’, for all files and folders contained in the given path.

find . -depth -name '*foo*' -execdir bash -c 'mv -i "$1" "${1//foo/bar}"' bash {} \;

Should you need something more sophisticated, you may give the Renamer node module a try.