Skip to content

Instantly share code, notes, and snippets.

@Jildor
Forked from luisuribe/delete_spaces.sh
Created June 1, 2017 08:46
Show Gist options
  • Save Jildor/2445a740c0ba55a62c21d66584546d9c to your computer and use it in GitHub Desktop.
Save Jildor/2445a740c0ba55a62c21d66584546d9c to your computer and use it in GitHub Desktop.
replace spaces, lower chars and remove special chars from file name
#!/bin/sh
find . -name '*' | sort | while read i
do
NEWFILE=`echo $i | tr '[A-Z]' '[a-z]' | tr ' ' '_' | tr '(' '[' | tr ')' ']' | tr '&' 'N'` ;
if [ "${i}" != "${NEWFILE}" ]; then
mv "${i}" "${NEWFILE}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment