public
Created

  • Download Gist
gistfile1.sh
Shell
1 2 3 4 5 6 7 8 9 10
#!/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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.