Skip to content

Instantly share code, notes, and snippets.

@jamiehs
Created July 12, 2019 18:48
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 jamiehs/74d084e875a7f9761c6b587456ae6086 to your computer and use it in GitHub Desktop.
Save jamiehs/74d084e875a7f9761c6b587456ae6086 to your computer and use it in GitHub Desktop.
Finds files in the current directory based on a file name pattern and then executes a move command while finding and replacing a component of the file name.
# remove echo to execute the actual mv command
find . -type f -name "prefix-*.json" -exec bash -c 'echo mv "$1" "${1/find/replace}"' -- {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment