I have a Solution for my problem now!
I use "goto"! Now my script is working.
#!/bin/csh
set m_path = "/net/fileserv1/leiterplatten/gerberdaten/$1"
(ls *.inf *.hcp *.info *.hcpy *.gbr *.drl > dir.lst) >& error.lst
start:
if(! -z error.lst) goto nofile
if(-e tsf.hcpy||-e tsd.hcpy||-e ncdrill.info) then
echo ----------------------------------------------
echo Files with four char extension will be renamed
echo ----------------------------------------------
if(-e tsf.hcpy) then
mv tsf.hcpy tsf.hcp
echo tsf.hcpy renamed to tsf.hcp
endif
if(-e tsd.hcpy) then
mv tsd.hcpy tsd.hcp
echo tsd.hcpy renamed to tsd.hcp
endif
if(-e ncdrill.info) then
mv ncdrill.info ncdrill.inf
echo ncdrill.info renamed to ncdrill.inf
endif
endif
echo ----------------------------------------------
if(-d $m_path) then
echo Folder $m_path exist
chmod 777 $m_path
echo Files will be copied to Folder $m_path
cp *.inf *.drl *.hcp *.gbr $m_path
chmod 777 $m_path/*
echo Files in current Folder will be erased
rm *.inf *.drl *.hcp *.gbr
else
echo Folder $m_path not exist
echo Folder will be created
mkdir $m_path
chmod 777 $m_path
echo Files will be copied to Folder $m_path
cp *.inf *.drl *.hcp *.gbr $m_path
chmod 777 $m_path/*
echo Files in current Folder will be erased
rm *.inf *.drl *.hcp *.gbr
endif
echo ----------------------------------------------
goto ende
nofile:
echo ----------------------------------------------
echo no files to copy
echo ----------------------------------------------
goto ende
ende:
rm dir.lst
rm error.lst
Thanks to all and bye
Moreno