#!/bin/csh
if !(-d $1) then
	echo $1 is not a directory
	exit 1
else if ((-e ${1}.tar) || (-e ${1}.tar.Z)) then
	echo Tar file already exists in superior for $1
	exit 2
endif
alias checkstatus '\!* ; if ($status) exec echo "\!*" failed - status = $status'
checkstatus du -s $1
checkstatus cd $1
checkstatus tar -clf ../${1}.tar .
checkstatus compress ../${1}.tar
checkstatus rm -rf * .* >& /dev/null
checkstatus mv ../${1}.tar.Z .
checkstatus cd ..
checkstatus du -s $1
