[comp.archives] [news.newusers.questions] Re: mget question

libes@cme.nist.gov (Don Libes) (08/06/90)

Archive-name: expect/06-Aug-90
Original-posting-by: libes@cme.nist.gov (Don Libes)
Original-subject: Re: mget question
Archive-site: durer.cme.nist.gov [129.6.32.4]
Archive-directory: /pub
Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)

In article <47200002@suna7> fireman@suna7.cs.uiuc.edu writes:
>When ftp'ing, how can I get a subset of a directory's files all at once if
>I don't use a wildcard? .... is there
>any way you can list them all out instead of doing "get filename" 10 times?

ftp lacks a general programming interface for doing this kind of
thing.  An alternative is to use a program like "expect" which can
drive ftp.  For instance, here is a little expect-script which would
fetch the files stored in the variable "files".  (You could set this
variable interactively, or pass the values in as an argument.)

	set len [length $files]
	for {set i 0} {$i < $len} {set i [expr $i + 1]} {
		send get [index $files $i]\r
		expect *success*ftp>*
	}

expect can actually automate any interactive program, not just ftp.

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".

Don Libes          libes@cme.nist.gov      ...!uunet!cme-durer!libes