Skip to content

Instantly share code, notes, and snippets.

@Famicoman
Created August 19, 2012 02:38
Show Gist options
  • Save Famicoman/3391205 to your computer and use it in GitHub Desktop.
Save Famicoman/3391205 to your computer and use it in GitHub Desktop.
File Renamer
#!/bin/bash
#Converts file names to something more ftp friendly
#Strips symbols, converts spaces to underscores, uppercase to lowercase
ls | while read -r FILE
do
mv -v "$FILE" `echo $FILE | tr ' ' '_' | tr -d '[{}(),\!:?~@#$%^&*+=;<>|]' | tr -d "\'" | tr '[A-Z]' '[a-z]' | sed 's/_-_/_/g'`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment