#!/bin/sh
 
# All copy rights saved to Yehuda Korotkin
# You may use this script, but you must give credit
#
# email: [email protected]
#
 
if [ ! -d $1 ] ; then
        echo "Usage: $0 <path> [FLAGS] "
        echo 
        echo "Flags (Optional):"
        echo " f = files only"
        echo " d = folders only"
        echo " x = (Default) files and folders"
        echo    
        echo "Example:"
        echo " $0 /some/where"
        echo "    OR "
        echo " $0 /some/where f"
        exit;
fi
 
SOURCE_DIR=$1
FIND_OPTIONS=""
case "$2" in
        f)
                FIND_OPTIONS=" --type f"
        ;;
        d)
                FIND_OPTIONS=" --type d"
        ;;
esac
 
for SRC in `find ${SOURCE_DIR} ${FIND_OPTIONS} -depth`
do
 
        DST=`dirname "${SRC}"`/`basename "${SRC}" | cut -c 1 | tr '[A-Z]' '[a-z]'`
        DST="$DST"`basename "${SRC}" | cut -c 2-`
        if [ "${SRC}" != "${DST}" ]
        then
                [ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}" || echo "${SRC} was not renamed"
        fi
done
scripts/convert_all_tree_to_camel_case.txt · Last modified: 2014/11/11 16:18 by yehuda
Back to top
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0