Last active
April 17, 2018 15:33
-
-
Save kavun/2a3704bfb31b84aaa3399ad11c78ea3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ -d $1 ]]; then | |
if [[ -d $1/.git ]]; then | |
cd $1 | |
dirn=${PWD##*/}; | |
today=`date '+%Y%m%d%H%M%S'`; | |
filen='./../'$dirn'_BeforeCaseChange_'$today'.zip'; | |
echo 'Backing up '$dirn' to '$filen | |
zip -rq $filen . | |
oldignorecase=$(git config --global --get core.ignorecase) | |
echo 'Setting "git config --global core.ignorecase false" from core.ignorecase='$oldignorecase | |
git config --global core.ignorecase false; | |
echo 'Making all files and folders lowercase'; | |
for f in `find *`; do | |
git mv -v "$f" "`echo $f | tr '[A-Z]' '[a-z]'`" > /dev/null 2>&1; | |
done; | |
echo 'Success!'; | |
echo ''; | |
echo 'Files and folders in '$dirn' have been made lowercase. Now you should stage all files, commit, and push to buddy.' | |
else | |
echo "$1 does not contain a .git folder" | |
exit 1 | |
fi | |
elif [[ -f $1 ]]; then | |
echo "$1 is a file, please provide a directory" | |
else | |
echo "$1 is not a valid folder" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment