Created
September 3, 2013 06:18
-
-
Save matglas/6420253 to your computer and use it in GitHub Desktop.
Clean up old build in Kraftwagen.
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/bash | |
DIR=`pwd` | |
if [ -d "$DIR/builds" ] | |
then | |
CURRENT=`ls -1 builds | sort | tail -1` | |
read -p "Do you want to remove all the old builds except $CURRENT (y/n)" -n 1 -s REMOVE_OLD_BUILDS | |
echo "" | |
if [ $REMOVE_OLD_BUILDS == "y" ] | |
then | |
for BUILD in $(ls -1 builds | sort) | |
do | |
# Remove build | |
if [ "$BUILD" != "$CURRENT" ] | |
then | |
sudo rm -rf "$DIR/builds/$BUILD" | |
fi | |
done | |
echo "Removed old builds" | |
else | |
echo "Safe choice :)" | |
fi | |
else | |
echo "No builds dir found." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I should check what the origina of the build folder is (check the symlink of build) to be sure not to remove the live version.