Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment