[comp.unix.wizards] How to make ftp interact with sh-commands?

xphyhofu%DDATHD21.BITNET@cunyvm.cuny.edu ( Joachim Holzfuss) (07/24/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.
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.
================================================================

lrb@rrivax.rri.uwo.ca (Lance R. Bailey) (07/25/90)

In article <23946@adm.BRL.MIL>, xphyhofu%DDATHD21.BITNET@cunyvm.cuny.edu ( Joachim Holzfuss) writes...
>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.
>Wat I did was:
>ftp> mget file.*
> ...
>Seems like ftp doesn't like me. Any good ideas?

what you need to do is ls file.* inlist and then use that to build a
list of ftp commands, or a ftp script. so you have one session to get,
you end it, build a script by prefixing all file names with get, the
whole file with open and user commands AND SUFFIXING THE FILE WITH A
CLOSE AND BYE. if you do not do that, many ftp implementations do not
recognize EOF as close and when you feed ftp with the script for
input, ftp goes into a tight/expensive forever-loop when the input
stops.

i implemented this using ftp as the tranport layer for uucico a
while ago and ran into the same problem. only i had a program that
talked to a popen to ftp, got the list, processed it and fed
the answers to ftp again. one session.

_________________________________
Lance R. Bailey, Systems Manager | Robarts Research Institute
email: lrb@rri.uwo.ca            | Clinical Trials Resources Group
  vox: 519-663-3787 ext. 4108    | P.O. Box 5015, 100 Perth Dr.
  fax: 519-663-3789              | London, Canada N6A 5K8