Created
July 24, 2015 12:47
-
-
Save graphbear/dcf40b8cdabc1e9416af to your computer and use it in GitHub Desktop.
clean special characters from file names
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
specChars () { | |
tr [:blank:] [_] | tr [/] [_] | tr -d [=~=][=!=][=@=][=#=][=$=][=%=][='('=][=')'=][=\'=][=,=][=.=][=:=][=';'=][=\\=] | |
} | |
IFS=$'\n' | |
files=$(ls -1) | |
for file in $files ; do | |
echo $file | |
newFile=$(specChars $file) | |
echo "$file" $newFile | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment