From: kko@fraser.sfu.ca (Samuel Ko)
Subject: Re: Automatic ftp session
Organization: Simon Fraser University, Burnaby, B.C., Canada
Date: Thu, 21 Jan 1993 19:09:48 GMT

jbowyer@cis.vutbr.cs (Bowyer Jeff) writes:

>I imagine the capability exists; therefore . . .

>Would someone please send me a sample shell program that ftp's to a
>site and returns a directory listing or gets a file . . . without user
>intervention.

How about this one ... 

Subject: A unix script to auto-download MSDOS files from SIMTEL20 mirrors

This is yet another release of this pretty popular UNIX shell script that
help you auto-download MSDOS files from /pub/msdos at oak.oakland.edu ...

---
How to use it ...
1) save this article as oakftp (or whatever name you like)
2) remove anything above #!/bin/sh
3) make this script executable (i.e. chmod u+x oakftp)
4) oakftp  directoryA file1 file2  directoryB file3 file4

---
If you favorite SIMTEL20 mirror is not oak.oakland.edu ... you can
change the first two lines after the comment box to

host=                   directory=
wuarchive.wustl.edu     /mirror/msdos/$1
ftp.uu.net              /systems/simtel20/msdos/$1
nic.funet.fi            /pub/msdos/SIMTEL20-mirror/$1
src.doc.ic.ac.uk        /pub/computing/systems/ibmpc/simtel20/$1
nic.switch.ch           /mirror/msdos/$1
archie.au               /micros/pc/simtel-20/$1
nctuccca.edu.tw         /SIMTEL20/msdos/$1

---
And as to the line  echo user anonymous -logname@hostname, you can 
also change it to  echo user anonymous -your_email_adresss 

---
As usual, I hope you will like this script, and any comments, suggestions
and flames are very much welcomed. Samuel

------------------------------- CUT HERE ---------------------------------
#!/bin/sh
#######################################################################
#                                                                     #
#     oakftp ...                                                      #
#     Shell script to auto-ftp files from the pub/msdos               #
#     directory at OAK.oakland.edu                                    #
#     Written by Alvin Khoo (khoo@fraser.sfu.ca) based on Jon         #
#     Granrose's getfile ...                                          #
#     Modified and updated by Samuel Ko (kko@sfu.ca) ... 93/01/17 ... #
#                                                                     #
#######################################################################

host=oak.oakland.edu
directory=pub/msdos/$1


if [ $# -lt 2 ]
then
	echo "Usage: $0 directoryA file1 file2 ... directoryB file3 file4 ..."
        echo "Example: $0 trojan-pro scanv99.zip arc-lbr shez83.zip"
	exit 1
else

(
	echo user anonymous -logname@hostname
	echo hash
	echo binary
	echo cd $directory
while test -n "$1"
do
   case $1 in
	4dos) 		echo cd .. ; echo cd 4dos;;
	abc) 		echo cd .. ; echo cd abc;;
	ada) 		echo cd .. ; echo cd ada;;
	ai)             echo cd .. ; echo cd ai;;
        aijournal) 	echo cd .. ; echo cd aijournal;;
	allcharge) 	echo cd .. ; echo cd allcharge;;
	apl) 		echo cd .. ; echo cd apl;;
	arc?lbr) 	echo cd .. ; echo cd arc-lbr;;
	asm?mag) 	echo cd .. ; echo cd asm-mag;;
        asmutl) 	echo cd .. ; echo cd asmutl;;
        astronomy)      echo cd .. ; echo cd astronomy;;
	at) 		echo cd .. ; echo cd at;;
	autocad) 	echo cd .. ; echo cd autocad;;
	awk) 		echo cd .. ; echo cd awk;;
	basic) 		echo cd .. ; echo cd basic;;
	batutl) 	echo cd .. ; echo cd batutl;;
	bbs) 		echo cd .. ; echo cd bbs;;
	bbsdoors) 	echo cd .. ; echo cd bbsdoors;;
	bbslists) 	echo cd .. ; echo cd bbslists;;
	bible) 		echo cd .. ; echo cd bible;;
	biology)        echo cd .. ; echo cd biology;;
        books) 		echo cd .. ; echo cd books;;
	borland) 	echo cd .. ; echo cd borland;;
	c) 		echo cd .. ; echo cd c;;
	cad) 		echo cd .. ; echo cd cad;;
	calculator) 	echo cd .. ; echo cd calculator;;
	Case)           echo cd .. ; echo cd case;;
        catalog) 	echo cd .. ; echo cd catalog;;
	cdrom)          echo cd .. ; echo cd cdrom;;
        chemistry)      echo cd .. ; echo cd chemistry;;
        cis) 		echo cd .. ; echo cd cis;;
	citadel) 	echo cd .. ; echo cd citadel;;
	clipper) 	echo cd .. ; echo cd clipper;;
	cmplngmag) 	echo cd .. ; echo cd cmplngmag;;
	cmu?pcip) 	echo cd .. ; echo cd cmu-pcip;;
	cobol) 		echo cd .. ; echo cd cobol;;
	compatibles) 	echo cd .. ; echo cd compatibles;;
	compress) 	echo cd .. ; echo cd compress;;
	compute?pc) 	echo cd .. ; echo cd compute-pc;;
	cplusplus) 	echo cd .. ; echo cd cplusplus;;
	crossasm) 	echo cd .. ; echo cd crossasm;;
	crossref) 	echo cd .. ; echo cd crossref;;
	database) 	echo cd .. ; echo cd database;;
	dbase) 		echo cd .. ; echo cd dbase;;
        dbms?mag)       echo cd .. ; echo cd dbms-mag;;
	ddjmag) 	echo cd .. ; echo cd ddjmag;;
        demacs)         echo cd .. ; echo cd demacs;;
	deskaccess) 	echo cd .. ; echo cd deskaccess;;
	deskjet) 	echo cd .. ; echo cd deskjet;;
	deskpub) 	echo cd .. ; echo cd deskpub;;
	desqview) 	echo cd .. ; echo cd desqview;;
	dirutl) 	echo cd .. ; echo cd dirutl;;
	disasm) 	echo cd .. ; echo cd disasm;;
	djgpp)          echo cd .. ; echo cd djgpp;;
        dskutl) 	echo cd .. ; echo cd dskutl;;
        dv?x)           echo cd .. ; echo cd dv-x;;
	editor) 	echo cd .. ; echo cd editor;;
	education) 	echo cd .. ; echo cd education;;
	eel) 		echo cd .. ; echo cd eel;;
	ega) 		echo cd .. ; echo cd ega;;
	electrical)     echo cd .. ; echo cd electrical;;
        emulators) 	echo cd .. ; echo cd emulators;;
        ezycom)         echo cd .. ; echo cd ezycom;;
        fido)           echo cd .. ; echo cd fido;;
	filedocs) 	echo cd .. ; echo cd filedocs;;
	filutl) 	echo cd .. ; echo cd filutl;;
	finance) 	echo cd .. ; echo cd finance;;
	flowchart) 	echo cd .. ; echo cd flowchart;;
	formgen) 	echo cd .. ; echo cd formgen;;
	forth) 		echo cd .. ; echo cd forth;;
	fortran) 	echo cd .. ; echo cd fortran;;
	fossil) 	echo cd .. ; echo cd fossil;;
	freemacs) 	echo cd .. ; echo cd freemacs;;
	genealogy) 	echo cd .. ; echo cd genealogy;;
        genie)          echo cd .. ; echo cd genie;;
        geography)      echo cd .. ; echo cd geography;;
        geoworks)       echo cd .. ; echo cd geoworks;;
	gif) 		echo cd .. ; echo cd gif;;
        gifnews)        echo cd .. ; echo cd gifnews;;
	gnuish) 	echo cd .. ; echo cd gnuish;;
	graph) 		echo cd .. ; echo cd graph;;
        graphics)       echo cd .. ; echo cd graphics;;
        gts?music)      echo cd .. ; echo cd gts-music;;
	hamradio) 	echo cd .. ; echo cd hamradio;;
	handicap) 	echo cd .. ; echo cd handicap;;
        hebrew)         echo cd .. ; echo cd hebrew;;
	hypertext) 	echo cd .. ; echo cd hypertext;;
        iconlang)       echo cd .. ; echo cd iconlang;;
	info) 		echo cd .. ; echo cd info;;
	inside?tp) 	echo cd .. ; echo cd inside-tp;;
	irit) 		echo cd .. ; echo cd irit;;
	ka9q?tcpip) 	echo cd .. ; echo cd ka9q-tcpip;;
	kermit) 	echo cd .. ; echo cd kermit;;
	keyboard) 	echo cd .. ; echo cd keyboard;;
	lan) 		echo cd .. ; echo cd lan;;
        langtutor)      echo cd .. ; echo cd langtutor;;
	lantimes) 	echo cd .. ; echo cd lantimes;;
	laptop) 	echo cd .. ; echo cd laptop;;
	laser) 		echo cd .. ; echo cd laser;;
	legal) 		echo cd .. ; echo cd legal;;
	linguistics) 	echo cd .. ; echo cd linguistics;;
	lisp) 		echo cd .. ; echo cd lisp;;
        literature)     echo cd .. ; echo cd literature;;
	logo) 		echo cd .. ; echo cd logo;;
	lotus123) 	echo cd .. ; echo cd lotus123;;
	mac) 		echo cd .. ; echo cd mac;;
	mapping) 	echo cd .. ; echo cd mapping;;
	math) 		echo cd .. ; echo cd math;;
	max) 		echo cd .. ; echo cd max;;
	menu) 		echo cd .. ; echo cd menu;;
	microcorn) 	echo cd .. ; echo cd microcorn;;
	microsoft) 	echo cd .. ; echo cd microsoft;;
	modem) 		echo cd .. ; echo cd modem;;
	modula2) 	echo cd .. ; echo cd modula2;;
        mormon)         echo cd .. ; echo cd mormon;;
	mouse) 		echo cd .. ; echo cd mouse;;
	msjournal) 	echo cd .. ; echo cd msjournal;;
	mswindows) 	echo cd .. ; echo cd mswindows;;
	music) 		echo cd .. ; echo cd music;;
	ncsatelnet) 	echo cd .. ; echo cd ncsatelnet;;
	network) 	echo cd .. ; echo cd network;;
	neural?nets) 	echo cd .. ; echo cd neural-nets;;
        notabene)       echo cd .. ; echo cd notabene;;
	opus) 		echo cd .. ; echo cd opus;;
	packet) 	echo cd .. ; echo cd packet;;
	pascal) 	echo cd .. ; echo cd pascal;;
	pc?jr) 		echo cd .. ; echo cd pc-jr;;
	pcmag) 		echo cd .. ; echo cd pcmag;;
	pcpursuit) 	echo cd .. ; echo cd pcpursuit;;
	pcresource) 	echo cd .. ; echo cd pcresource;;
	pctech) 	echo cd .. ; echo cd pctech;;
	pctechniques) 	echo cd .. ; echo cd pctechniques;;
	perl) 		echo cd .. ; echo cd perl;;
	pgmutl) 	echo cd .. ; echo cd pgmutl;;
	pibterm) 	echo cd .. ; echo cd pibterm;;
	pilot) 		echo cd .. ; echo cd pilot;;
        pktvrdr)        echo cd .. ; echo cd pktdrvr;;
	pli) 		echo cd .. ; echo cd pli;;
	plot) 		echo cd .. ; echo cd plot;;
	postscript) 	echo cd .. ; echo cd postscript;;
	preprocess) 	echo cd .. ; echo cd preprocess;;
	printer) 	echo cd .. ; echo cd printer;;
	procomm) 	echo cd .. ; echo cd procomm;;
	prodigy) 	echo cd .. ; echo cd prodigy;;
	progjourn) 	echo cd .. ; echo cd progjourn;;
	prolog) 	echo cd .. ; echo cd prolog;;
	qbasic) 	echo cd .. ; echo cd qbasic;;
	qedit) 		echo cd .. ; echo cd qedit;;
        qemm)           echo cd .. ; echo cd qemm;;
	qmodem) 	echo cd .. ; echo cd qmodem;;
	qpascal) 	echo cd .. ; echo cd qpascal;;
        qtrdeck)        echo cd .. ; echo cd qtrdeck;;
	ramdisk) 	echo cd .. ; echo cd ramdisk;;
	rbbs?pc) 	echo cd .. ; echo cd rbbs-pc;;
	screen) 	echo cd .. ; echo cd screen;;
        security)       echo cd .. ; echo cd security;;
        simulation)     echo cd .. ; echo cd stimulation;;
	small?c) 	echo cd .. ; echo cd small-c;;
	smalltalk) 	echo cd .. ; echo cd smalltalk;;
	snobol4) 	echo cd .. ; echo cd snobol4;;
	sound) 		echo cd .. ; echo cd sound;;
	spreadsheet) 	echo cd .. ; echo cd spreadsheet;;
	sprint) 	echo cd .. ; echo cd sprint;;
	starlink) 	echo cd .. ; echo cd starlink;;
	starter) 	echo cd .. ; echo cd starter;;
	statistics) 	echo cd .. ; echo cd statistics;;
        stunnpc)        echo cd .. ; echo cd stunnpc;;
	surfmodl) 	echo cd .. ; echo cd surfmodl;;
	swap) 		echo cd .. ; echo cd swap;;
	sysutl) 	echo cd .. ; echo cd sysutl;;
        tagbbs)         echo cd .. ; echo cd tagbbs;;
	taxes) 		echo cd .. ; echo cd taxes;;
        teaching)       echo cd .. ; echo cd teaching;;
	telegard) 	echo cd .. ; echo cd telegard;;
	telix) 		echo cd .. ; echo cd telix;;
	tex) 		echo cd .. ; echo cd tex;;
	tiff) 		echo cd .. ; echo cd tiff;;
	trojan?pro) 	echo cd .. ; echo cd trojan-pro;;
	turbo?c) 	echo cd .. ; echo cd turbo-c;;
	turbobas) 	echo cd .. ; echo cd turbobas;;
	turbopas) 	echo cd .. ; echo cd turbopas;;
        turbovis)       echo cd .. ; echo cd turbovis;;
	txtutl) 	echo cd .. ; echo cd txtutl;;
        ubasic)         echo cd .. ; echo cd ubasic;;
	uemacs) 	echo cd .. ; echo cd uemacs;;
	uucp) 		echo cd .. ; echo cd uucp;;
	ventura) 	echo cd .. ; echo cd ventura;;
	vga) 		echo cd .. ; echo cd vga;;
        visbasic)       echo cd .. ; echo cd visbasic;;
        viscii)         echo cd .. ; echo cd viscii;;
        voice)          echo cd .. ; echo cd voice;;
	voicemail) 	echo cd .. ; echo cd voicemail;;
	waffle) 	echo cd .. ; echo cd waffle;;
	weather)        echo cd .. ; echo cd weather;;
        windows3) 	echo cd .. ; echo cd windows3;;
	wordperf) 	echo cd .. ; echo cd wordperf;;
	worldmap) 	echo cd .. ; echo cd worldmap;;
	wpj?mag)        echo cd .. ; echo cd wpj-mag;;
        x?10) 		echo cd .. ; echo cd x-10;;
	xlisp) 		echo cd .. ; echo cd xlisp;;
	zip) 		echo cd .. ; echo cd zip;;
	zmodem) 	echo cd .. ; echo cd zmodem;;
	zoo) 		echo cd .. ; echo cd zoo;;
	*.*)		echo get $1;;
      esac
echo pwd
shift
done
	echo bye

) | ftp -n -v $host 

fi


Newsgroups: comp.unix.questions