Skip to content

Instantly share code, notes, and snippets.

@larzconwell
Created May 13, 2012 20:05
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 larzconwell/2689980 to your computer and use it in GitHub Desktop.
Save larzconwell/2689980 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
find . | grep "\[" | while read file; do
oldfile=$(readlink -f "$file")
echo "$oldfile"
newfile=$(echo "$oldfile" | sed 's/[^/A-Za-z0-9_ ]//g')
newfile=$(echo "$newfile" | sed 's/[ *]/_/g')
echo "$newfile"
mv "$oldfile" "$newfile"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment