Skip to content

Instantly share code, notes, and snippets.

@mmubasher
Created October 26, 2020 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmubasher/be00a9c90d6fe04e4d9c89dacd29767b to your computer and use it in GitHub Desktop.
Save mmubasher/be00a9c90d6fe04e4d9c89dacd29767b to your computer and use it in GitHub Desktop.
Find and replace files and directories by name
find . -name '*new_name*' -type f -exec bash -c 'mv $0 ${0/previous_name}' {} \;
find . -name '*new_name*' -type d -exec bash -c 'mv $0 ${0/previous_name}' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment