Skip to content

Instantly share code, notes, and snippets.

@esteban-gs
Last active August 27, 2021 00: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 esteban-gs/5984aba7af3a9b0b50b1594aa838c356 to your computer and use it in GitHub Desktop.
Save esteban-gs/5984aba7af3a9b0b50b1594aa838c356 to your computer and use it in GitHub Desktop.
Remove special chars from files and directories recursively - Linux / Mac

Via zsh. Enable zmv

autoload zmv

Replace all nont alpha-numeric chars with -

zmv '(**/)(*)' '$1${2//[^A-Za-z0-9]/_}'

Add suffix to all dirs and files recursively

zmv  '(**/)(*)' '$1$2_Archived'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment