Skip to content

Instantly share code, notes, and snippets.

@glennr
Created December 2, 2009 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glennr/247325 to your computer and use it in GitHub Desktop.
Save glennr/247325 to your computer and use it in GitHub Desktop.
#!/bin/sh
###
# Bash shell script to convert filenames with
# uppercase + spaces to lowercase + underscores
# E.g.
# Moving "Goudy Old Style BT.ttf" to "goudy_old_style_bt.ttf"
#
# Author: Glenn Roberts
#
# Released under the MIT license
#
###
for i in *
do
j=`echo $i | tr '[A-Z]' '[a-z]'`
k=`echo $j | tr ' ' '_'`
echo "Moving \"" $i "\" to \"" $k "\""
mv "$i" $k
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment