#!/bin/csh 

set files = `find . -name \*AMS\*.txt`
set odir = /users/rsg/observatory/buoy/pml/L4/data

foreach file($files)
   set fname = `echo $file:t`
   echo $fname
   set year = `echo $fname | cut -c1-4`
   set yyyyjjj = `echo $fname | cut -c1-7`
   if (-e $odir/$year/$yyyyjjj/$fname) then
      echo "$fname exists" 
      /bin/scp $file $odir/$year/$yyyyjjj/$fname   
      #set rmdir = `echo $file | cut -c1-9`
      #/bin/rm -rf $rmdir
   else
      echo "$fname does not exist"
      #set rmdir = `echo $file | cut -c1-9`
      #/bin/rm -rf $rmdir
   endif

end




exit(0)

