*BSD News Article 55799


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!news.sprintlink.net!athos.itribe.net!server.esva.net!server.esva.net!thom
From: Thom Henderson <thom@esva.net>
Newsgroups: comp.unix.bsd.bsdi.misc,comp.unix.admin,comp.unix.misc,comp.unix.programmer
Subject: Re: Batching FTP File Transfer
Date: Sat, 25 Nov 1995 10:33:42 -0500
Organization: The Eastern Shore of Virginia Network
Lines: 59
Message-ID: <Pine.BSD/.3.91.951125102856.10731C-100000@server.esva.net>
References: <47vrge$65n@news.easyinternet.ca>
	<48icp3$gkt@ktel.ktel.freenet.columbus.oh.us> <MEI.95Nov23142530@losira.bb-data.de>
NNTP-Posting-Host: server.esva.net
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
In-Reply-To: <MEI.95Nov23142530@losira.bb-data.de> 
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.bsdi.misc:1578 comp.unix.admin:35509 comp.unix.misc:19733 comp.unix.programmer:31214

On 23 Nov 1995, Bodo Meissner wrote:

> You should look for a program named "batchftp". 
> It's a C program which reads a special script file 
> and starts FTP to do the transfers. It tries to repeat
> failed transfers.

Not knowing the problem was already solved, I whomped up a shell script 
to do it.  I have a "get" subdirectory in my user directory, and when I 
want something large and/or hard to get into, I save the URLs in a file 
named "goget" and put it in the directory.  Sometimes I run it manually, 
but more often I wait until cron get around to it.  It uses www instead 
of ftp because www can be told "go get thus and so and then stop", 
whereas ftp seems to need to be interactive.  Here 'tis:

---------------- cut here ----------------
#!/bin/bash

cd /usr/home/thom/get

if [ -f interim ]
then
	echo Already busy getting things
	exit
fi

if [ -s goget ]
then
	got=no

	for thing in `cat goget`
	do
		base=`basename $thing`

		if [ -s $base ]
		then
			echo Already have $base
		else
			echo Getting $base
			if	/usr/contrib/bin/www -o interim $thing >/dev/null 2>&1
			then
				echo Got $base
				mv interim $base
			else
				echo Failed to get $base
				rm interim
			fi
			got=yes
		fi
	done

	if [ $got = no ]
	then
		echo Got everything
		mv goget goget.did
	fi
fi

--------------- cut here -----------------