#!/bin/bash

cd GRADES
for semester in `\ls -d fall*`
	do
		echo -ne "\e[00;31mDeleting\e[00m \e[00;33m.final\e[00m & \e[00;33m.stat\e[00m in \e[00m \e[00;36m$semester\e[00m  \t"
		cd $semester
		for lecture in `\ls | grep   '\<K[0-9][0-9][0-9]\>'`
			do
				cd $lecture
				export final=`echo $lecture".final"`
				export stat=`echo $lecture".stat"`
				if [ -e $final ] ; then rm -rf $final ; fi
				if [ -e $stat ]  ; then rm -rf $stat  ; fi
				cd ..
			done
		echo -e "[\e[00;31mDONE\e[00m]"
		cd ..
	done
for semester in `\ls -d spring*`
	do
		echo -ne "\e[00;31mDeleting\e[00m \e[00;33m.final\e[00m & \e[00;33m.stat\e[00m in \e[00m \e[00;36m$semester\e[00m \t"
		cd $semester
		for lecture in `\ls | grep   '\<K[0-9][0-9][0-9]\>'`
			do
				cd $lecture
				export final=`echo $lecture".final"`
				export stat=`echo $lecture".stat"`
				if [ -e $final ] ; then rm -rf $final ; fi
				if [ -e $stat ]  ; then rm -rf $stat  ; fi
				cd ..
			done
		echo -e "[\e[00;31mDONE\e[00m]"
		cd ..
	done
cd ..
exit 1
