ftp question
Gaijin
gaijin at clearwire.net
Mon Jun 25 15:31:16 EDT 2007
Gregory Nowak wrote:
> Say I want to get 2 files via ftp, but I want to do it in a specific
> order, and I don't want file2 to start downloading until file1 is
> finished downloading.
This may need a little editing:
#!/bin/bash
for ( file in filelist.txt ) do {
lynx -d ftp.wherever.com/directory/%file > ~/savedir/%file
grep -i "%file" filelist.txt > filelist.tmp
mv -f filelist.tmp filelist.txt
} done
Crap it's been a long time. Anyway, if you have a list of files
you'd like to download saved to filelist.txt, you can run it in a for
loop. Use the lynx dump feature to dump what you want to a file. Just
point lynx at it and redirect the output to %file, which will be the
file listed in filelist.txt. Then do an inverse grep on filelist.txt to
remove the filename and redirect grep's output to a temp file. Then
move the temp file back to filelist.txt, overwriting it, and you should
be done. [Ctrl+C] will interrupt this script at any time, and resume
where you left off . I'm *pretty* sure it will work. I'm just not sure
I got the for command written properly. Yeah, it could really be
prettied up using %1 from the command line to name filelist.txt instead.
Also pointing lynx's output to a download dir would help too, but the
principal idea is there. Have you considered the 'wget' command? I
don't know why you're downloading files that way. Are you on a dialup
connection? The only thing about the script above is it expects a
specific site and directory. Considerably more work would be needed to
make it a more generic script that could be used for any site, dir, and
file list. Anyway, I HTH,
Michael
More information about the Speakup
mailing list