xphyhofu%DDATHD21.BITNET@cunyvm.cuny.edu ( Joachim Holzfuss) (07/19/90)
Hi, is there any wizard out there being able to shed some light on this? I have to ftp files automatically from a directory,that grows permanently. (Yes it's on a vms-vax). Wat I did was: ftp> mget file.* ftp> mdelete file.* with the result, that files ariving between both calls get deleted by mdelete. Now there is ftp> ls file.* inlist which I could use, but I can't do: ftp> mget "/bin/cat inlist" (works for ls file.* "more" ) or something like (using a macdef) ftp> $transfer file.* (no globbing possible) Seems like ftp doesn't like me. Any good ideas? ================================================================ == J. Holzfuss BITNET: xphyhofu@ddathd21.bitnet == == IAP, TH Darmstadt unix: hofu@chaos (130.83.3.1) == == Schlossgartenstr.11 VOICE: 06151-162884 == == 61 Darmstadt, FRG == == == (!) If I let go a hammer on a planet having a positive gravity, I need not see it fall to know that it has, in fact, fallen. -- Spock, "Court Martial," stardate 2948.9. ================================================================
libes@cme.nist.gov (Don Libes) (07/20/90)
In article <23921@adm.BRL.MIL> xphyhofu%DDATHD21.BITNET@cunyvm.cuny.edu ( Joachim Holzfuss) writes: >I have to ftp files automatically from a directory,that grows permanently. The recent USENIX Proceedings (Anaheim) included a paper on a program I wrote called "expect" that can solve this type of problem. expect is a general system for automating interactive programs, not just ftp. >What I did was: > ftp> mget file.* > ftp> mdelete file.* >with the result, that files ariving between both calls get deleted by mdelete. >Now there is > ftp> ls file.* inlist >which I could use, but I can't do: > ftp> mget "/bin/cat inlist" (works for ls file.* "more" ) >or something like (using a macdef) > ftp> $transfer file.* (no globbing possible) > >Seems like ftp doesn't like me. Any good ideas? An expect script could do everything including starting up ftp, but here is just the interesting portion. I'll assume the script has already sent the ftp commands to create the file "inlist" as in your original message. The rest of the script is then: set inlist [exec cat inlist] ;# read into variable inlist set len [length $inlist] for {set i 0} {$i < $len} {set i [expr $i+1]} { set file [index $inlist $i] send get $file\r ;# get the file expect *successful*ftp>* send delete $file\r ;# delete it on remote system expect *successful*ftp>* } It helps if you know Tcl - the language expect uses - but it looks very much like a cross of the shell and C, so you can probably discern how the script works just by looking at it. expect may be ftp'd as pub/expect.shar.Z from durer.cme.nist.gov. If you cannot ftp, you may request email copies by mailing to "library@ cme.nist.gov". The contents of the message should be (no subject line) "send pub/expect.shar.Z". Once you have retrieved the system, please read the INSTALL file. The paper mentioned above can be ftp'd as pub/expect.ps.Z. Don Libes libes@cme.nist.gov ...!uunet!cme-durer!libes