Download tool for multiple files or wildcards in http

gumnos (Tim Chase) gumnos at hotmail.com
Wed Apr 7 12:58:11 UTC 2004


> As for the script to pipe to wget, I'm getting errors with that

Now that I've got the skeleton format for the naming convention, using
your example of

    www.loc.gov/nls/braille/12269v01.brf

(which I assume is via HTTP, rather than FTP, and for this example, that
there are three of them, ending 01.brf, 02.brf, and 03.brf) you should
be able to use

    seq 1 3 |
    sed "s at .*@http://www.loc.gov/nls/braille/12269v0&@" |
    wget -i - --http-user="my_username" --http-password="my_password"

(all on one line, broken at the pipes to prevent my cursed mailer from
breaking it in the wrong places)  You'll have to include your wget
credentials in the wget part of the command.  This may have been the
error you were getting back in your first try--just tack it on the end
(the --http-user and --http-password, as described in the man pages for
wget).

You can try each piece progressively.  The "seq 1 3" should just output
the numbers 1 through 3.  Add the sed statement, and you should get the
list of URLs to download for your verification.  If you're using
"screen", you can copy and paste one of these composited URLs onto a
single command line with wget, to just get that one file.

If you've got more than 9 items, "seq" can produce zero-padded results
to make your job easier, so if you've got, say, War And Peace (or some
other huge tome, with 13 parts in this example) you could use

    seq -w 1 13 |
    sed "s at .*@http://www.loc.gov/nls/braille/12269v&@" |
    wget -i - --http-user="my_username" --http-password="my_password"

(again, all on one line).  If you use FTP rather than HTTP, just make
the obvious change of text in there.  Oh, and you'll want to use your
own username and password there. (grins)

Hope this gets you sent off in the right direction.  Oh, and make sure
that you've got all that punctuation in those commands...miss any one of
them, and it's prone to holler at you.  At least it won't hose your box.
Feel free to fire back any questions.  Best wishes,

-tim











More information about the Blinux-list mailing list