#!/bin/csh

echo foo
find . -name foo -exec rm {} \;
find . -name 'foo*' -exec rm {} \;
echo sharp
find . -name '#*' -exec rm {} \;
echo hide
find . -name '.*' -exec rm {} \;
echo nyoro
find . -name '*~' -exec rm {} \;
echo .b
find . -name '*.b' -exec rm {} \;
echo .bb
find . -name '*.bb' -exec rm {} \;
echo .bak
find . -name '*.bak' -exec rm {} \;
echo .BAK
find . -name '*.BAK' -exec rm {} \;
echo core
find . -name core -exec rm {} \;
find . -name 'core*' -exec rm {} \;
echo a.out
find . -name a.out -exec rm {} \;
echo cosmos.t
find . -name cosmos.t -exec rm {} \;
echo landscape.t
find . -name landscape.t -exec rm {} \;
echo .pdf
find gbs/doc/xml/man -name '*.pdf' -exec rm {} \;
echo tex
find gbs/doc/xml/work -name '*.tex' -exec rm {} \;
find gbs/doc/xml/work -name '*.aux' -exec rm {} \;
find gbs/doc/xml/work -name '*.bbl' -exec rm {} \;
find gbs/doc/xml/work -name '*.blg' -exec rm {} \;
find gbs/doc/xml/work -name '*.dvi' -exec rm {} \;
find gbs/doc/xml/work -name '*.log' -exec rm {} \;
find gbs/doc/xml/work -name '*.toc' -exec rm {} \;
rm gbs/doc/xml/man/man
rm -rf gbs/doc/xml/man/html/*-*
rm -rf gbs/doc/xml/man/html/index.html
rm -rf gbs/doc/xml/man/html/images

echo rm work

foreach a ( gbs/env/proj/unix/*/work )
    echo $a
    mv $a/CVS tmp.CVS
    mv $a/d tmp.d
    rm -r $a/*
    mv tmp.CVS $a/CVS
    mv tmp.d $a/d
end

echo rm lib

foreach a ( gbs/env/proj/unix/*/lib )
    echo $a
    mv $a/CVS tmp.CVS
    mv $a/d tmp.d
    rm -r $a/*
    mv tmp.CVS $a/CVS
    mv tmp.d $a/d
end


echo rm bin

foreach a ( gbs/env/proj/unix/*/bin )
    echo $a
    mv $a/CVS tmp.CVS
    mv $a/d tmp.d
    rm -r $a/*
    mv tmp.d $a/d
    mv tmp.CVS $a/CVS
end

echo unix

mv gbs/env/proj/unix/CVS tmp.CVS.u

foreach a ( gbs/env/proj/unix/* )
    echo $a
    mv $a/bin tmp.bin
    mv $a/work tmp.work
    mv $a/lib tmp.lib
    mv $a/CVS tmp.CVS
    rm -r $a/*
    mv tmp.bin $a/bin
    mv tmp.lib $a/lib
    mv tmp.work $a/work
    mv tmp.CVS $a/CVS
end

mv tmp.CVS.u gbs/env/proj/unix/CVS

if ( -e gbs/env/proj/mac/build/cosmos_8.build/Debug ) then
	rm -fr gbs/env/proj/mac/build/cosmos_8.build/Debug/*
endif
if ( -e gbs/env/proj/mac/build/cosmos_8.build/Release ) then
	rm -fr gbs/env/proj/mac/build/cosmos_8.build/Release/*
endif 
if ( -e gbs/env/proj/mac/build/Debug ) then
	rm -fr gbs/env/proj/mac/build/Debug/*
endif
if ( -e gbs/env/proj/mac/build/Release ) then
	rm -fr gbs/env/proj/mac/build/Release/*
endif


