Skip to content

Instantly share code, notes, and snippets.

@dvliman
Created August 9, 2019 22:20
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 dvliman/ea3926c9320b150317bdf87dbe59fc88 to your computer and use it in GitHub Desktop.
Save dvliman/ea3926c9320b150317bdf87dbe59fc88 to your computer and use it in GitHub Desktop.
# rename files to have underscores instead of ' ', '(', and ')' - runs on * or takes extension argument: i.e., `rename_filename_chars txt`
rename_filename_chars() { for file in *"$1"; do mv -n "$file" $(echo $file | sed -e "s/ /_/g" | sed -e "s/(/_/g" | sed -e "s/)/_/g"); done }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment