#!/bin/bash
# We keep the 20 more recent nightly builds
LIMIT=20
# Remove Debian's .deb
FILES=`ls -t ~/sip-communicator/nightly/debian/sip-communicator*nightly.build.*.deb`
COUNT=0
for file in $FILES
if [ $COUNT -ge $LIMIT ]; then
rm "$file"
fi
((COUNT++))
# Remove Debian's .changes
FILES=`ls -t ~/sip-communicator/nightly/debian/sip-communicator*nightly.build.*.changes`
COUNT=0
for file in $FILES
if [ $COUNT -ge $LIMIT ]; then
rm "$file"
fi
((COUNT++))
# Remove RPMs
FILES=`ls -t ~/sip-communicator/nightly/rpm/sip-communicator*nightly.build.*.rpm`
COUNT=0
for file in $FILES
if [ $COUNT -ge $LIMIT ]; then
rm "$file"
fi
((COUNT++))
# Remove generic .jar
FILES=`ls -t ~/sip-communicator/nightly/generic/sip-communicator*nightly.build.*.jar`
COUNT=0
for file in $FILES
if [ $COUNT -ge $LIMIT ]; then
rm "$file"
fi
((COUNT++))
# Remove Linux .bin
FILES=`ls -t ~/sip-communicator/nightly/linux/sip-communicator*nightly.build.*.bin`
COUNT=0
for file in $FILES
if [ $COUNT -ge $LIMIT ]; then
rm "$file"
fi
((COUNT++))
# Remove MacOSX .dmg
FILES=`ls -t ~/sip-communicator/nightly/macosx/SIP*nightly.build.*.dmg`
FILES=`echo "$FILES" | sed -e s/" "/__SPACE__/g`
COUNT=0
for file in $FILES
file=`echo "$file" | sed -e s/__SPACE__/" "/g`
if [ $COUNT -ge $LIMIT ]; then
rm "$file"
fi
((COUNT++))
# Remove Windows .zip
FILES=`ls -t ~/sip-communicator/nightly/windows/sip-communicator*nightly.build.*.zip`
COUNT=0
for file in $FILES
if [ $COUNT -ge $LIMIT ]; then
rm "$file"
fi
((COUNT++))
.