	program gra
C program to get Guard-rasnik files on kakap
C You provide a date and the system C below. 
C At the end of al the technical stuff you have a the file names in
C string 'sfname' with logical length 'sflen', ordered by date/time.
C By the way, it is easy to skip  the date selection to get all files of 
C that particular rasnik system.
C MV 20000703
        character*8 datum
        character*11 sysras
	character*240 line
	character*30 sfname(10000)
	integer sflen
C--
C provide date
C--
        datum='20010802'
C--
C provide system
C--
	sysras='ras.'
C or	sysras='GuardSouth.'
C--
C TECHNICAL STUFF
C--
C--
	sflen=0
C ls on paling to file guardfile
	istat=system('gra1.exe > guardfile')
C prepare grep on system
	open(30,file='gra2.exe')
	write(30,*)'grep -i ',sysras,' guardfile'
        close(30)
	istat=system('chmod +x gra2.exe')
C grep on system to file sysfile
	istat=system('gra2.exe > sysfile')
C loop for filenames
	open(30,file='sysfile')
 10	continue
	read(30,'(a)',END=99,ERR=99)line
C--
C date selection and store in 'sfname'
C--
	if (line(14:21).eq.datum) then
	   sflen=sflen+1
	   sfname(sflen)=line(3:32)
*           write(*,*)sfname(sflen)
        endif
	goto 10
 99	continue

C--
C results in sfname with length sflen
C--

******************************************************************
* to remove files from paling....                                *
* input: string array 'sfname' with file names and length 'sflen'*
******************************************************************
	open(33,file='remove.exe')
	write(33,*)'open paling.nikhef.nl'
	write(33,*)'cd /projects/MDT/Data/Rasnik/Images'
	write(33,*)'ls '
	do i=1,sflen
              write(33,*)'delete ',sfname(sflen)
        enddo
	write(33,*)'bye'
        close(33)

** here is the actual command...
* 	istat=system('ftp < remove.exe')
**



	end
	

	

	

	
	
