clean.sh 1.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#! /bin/sh


DATEMIN=`date -d '2 months ago' +%Y%m%d`;


echo "Two months ago, we were on : $DATEMIN";

cd build/;

#those have folder in it
12 13
#sid-i386 sid-amd64 intrepid-i386
for i in win32 win64 wince source
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
do 
	echo "Entering folder $i...";
	cd  $i;
	if [ ! -d backup ]; then
		echo "Making a backup dir in $i"
		mkdir backup
	fi
	for j in `ls -1 -b  | xargs`
	do 
		day=`echo $j |cut -d- -f2`;

		if [[ $day < $DATEMIN ]]; then
			echo "Older than it should be  $i/$j";
			DATETEST=`date -d $day +%u`
			if [[ $DATETEST = 1 ]];
			then
				mv $j backup/
				echo "Backing it up"
			else	
				rm -rf $j/
				echo "GO TO /dev/null"
			fi
		fi
	done
	cd ..;
done

#those have just files in it
Rafaël Carré's avatar
Rafaël Carré committed
42
for i in macosx macosx-intel
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
do 
	echo "Entering folder $i...";
	cd  $i;
	if [ ! -d backup ]; then
		echo "Making a backup dir in $i"
		mkdir backup
	fi
	for j in `ls -1 -b  | xargs`
	do 
		day=`echo $j |cut -d- -f2`;

		if [[ $day < $DATEMIN ]]; then
			echo "Older than it should be  $i/$j";
			DATETEST=`date -d $day +%u`
			if [[ $DATETEST = 1 ]];
			then
				mv $j backup/
				echo "Backing it up"
			else	
				rm -rf $j
				echo "GO TO /dev/null"
			fi
		fi
	done
	cd ..;
done

cd ..; # quitting build/