*BSD News Article 54898


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!munnari.OZ.AU!spool.mu.edu!olivea!decwrl!lll-winken.llnl.gov!uwm.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!not-for-mail
From: wyang@ktel.freenet.columbus.oh.us (William Yang)
Newsgroups: comp.unix.bsd.bsdi.misc,comp.unix.admin,comp.unix.misc,comp.unix.programmer
Subject: Re: Batching FTP File Transfer
Date: 17 Nov 1995 11:20:51 -0500
Organization: The Greater Columbus FreeNet
Lines: 36
Message-ID: <48icp3$gkt@ktel.ktel.freenet.columbus.oh.us>
References: <47vrge$65n@news.easyinternet.ca>
NNTP-Posting-Host: ktel.freenet.columbus.oh.us
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.bsdi.misc:1478 comp.unix.admin:34999 comp.unix.misc:19486 comp.unix.programmer:30794

In article <47vrge$65n@news.easyinternet.ca>,
Tom Hill  <TomHill@EasyInternet.ca> wrote:
> I would like to be able to write a shell script that would perform FTP 
> file transfers on batches of files, from a BSDI server to a Mac running 
> an FTPD host.
> Is it possible to do batched file transfers with the unix FTP client? Can 
> these be automated the the FTP macdef feature?
> I would appreciate hearing from anyone who has done this.
> Thank-you.

Basic idea below.  You can flesh it out as you see fit.

#! /bin/sh

FTPUSERNAME="anonymous"

# modify this appropriately
FTPPASSWORD="${USER}@this.should.be.an.e-mail-able.site"

# modify this appropriately
SITE=ftp.site.on.the.net

# add all the proper commands here.  This is precisely what you'd type
# once you connected to an FTP site (less the bin and prompt commands)

FTPCMDS="cd /this/is/a/path
mget file1 file2 file3
cd /this/is/a/path
mget file4 file5 file6"

echo "quote user ${FTPUSERNAME}
quote pass ${FTPPASSWORD)
bin
prompt
${FTPCMDS"
quit | ftp -n ${SITE}