#! /bin/bash

if (( $# != 1 ))
then
	echo "usage $0 Directory"
	exit -1
fi

HOMEDIR=`pwd`

DIR="$1"
shift

if [ ! -e "TEMPLATE" ]
then
	echo "TEMPLATE" does not exist
	exit -1
fi

if [ ! -e "$DIR" ]
then
	echo "$DIR" does not exist
	exit -1
fi

cd "$DIR"
rm -rf manifest *.bash Classes *.error run.jar TestPrograms Summary.txt
rm -rf StudentPrograms/*/program.{err,print,out} StudentPrograms/*/usercode.user.s
cp -r "$HOMEDIR/TEMPLATE"/* .

