Skip to content

Instantly share code, notes, and snippets.

@luisuribe
Created September 20, 2010 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save luisuribe/588240 to your computer and use it in GitHub Desktop.
Save luisuribe/588240 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