Saturday, 22 January 2011

lowercasing file names

(thanks to Ian Toyn)

find . -exec chmod u+w {} \;
for i in `find . ! -type d -name '*[A-Z]*' -print`
do
    oldname=`basename $i`
    newname=`echo $oldname | tr '[A-Z]' '[a-z]'`
    mv $i `dirname $i`/$newname
done
for i in `find . -type d -name '*[A-Z]*' -print`
do
    oldname=`basename $i`
    newname=`echo $oldname | tr '[A-Z]' '[a-z]'`
    mv $i `dirname $i`/$newname
done

No comments:

Post a Comment