Created
October 17, 2013 13:53
-
-
Save mattslack/7025284 to your computer and use it in GitHub Desktop.
Clean up a directory full of git repos. Maybe get back some hard disk space.
This file contains hidden or 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
#!/bin/zsh | |
PROJECTS_DIR="${HOME}/Projects" | |
cd $PROJECTS_DIR | |
for client in `find ${PROJECTS_DIR} -type d -name ".git"`; do | |
cd ${client} | |
cd .. | |
echo "Checking: `pwd`" | |
git gc | |
git remote prune origin | |
if [ -d log ]; then | |
echo "Removing logs...\c" | |
rm -f ./log/*.log | |
echo 'done.' | |
fi | |
echo "" | |
done | |
echo "Removing extra logs...\c" | |
find ${PROJECTS_DIR} -type f -iname "*development.log" -exec rm {} \; | |
find ${PROJECTS_DIR} -type f -iname "*test.log" -exec rm {} \; | |
echo "done." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment