cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: doing multiple file download

From: <Joern.Hartroth_at_comma-soft.com>
Date: Mon, 18 Dec 2000 18:12:36 +0100

Hi all!

> -----Original Message-----
> From: Stenberg Björn [mailto:Bjorn.Stenberg_at_elema.siemens.se]
> Sent: Monday, December 18, 2000 5:16 PM
> To: 'curl_at_contactor.se'
> Subject: RE: doing multiple file download
>
>
> > Do we need some weird variable in the -o
> > string like with the #<num> stuff
> > for the {} and [] multiple URL stuff?
>
> If there is a convention for specifying multiple files
> already, stick to it.
> Otherwise a simple comma separated list seems good enough to me.
>
> Would it be messy to also support this model:
>
> curl -o file1 http://url1 -o file2 http://url2
>
> That way, the command line is more easily built from shell
> scripts and such.
>

I second this motion. The currently existing syntax has the advantage -
apart from being wierd :) - of providing a concise notation for all those
cases where the desired output filename can be generated in a fairly regular
form from (parts of) the URL. However, it is less appropriate for cases when
one wishes to download several entirely unrelated URLs and save them under
equally unrelated output filenames.
If the command line parser can be made to recognize the relations between -o
expressions and associated URL targets, it might even be possible to combine
the regular-multifile and the irregular-multifile syntax to something like

        curl -o report_#1.html http://site1/doc-{foo,bar}.html -o
comment_#1.txt http://site1/doc-[1-12].txt

which of course is supposed to gather both of the doc*.htmls and all of the
doc*.txts into files with meaningful names.

What is not so obvious is how the raw feature of supporting multiple URL
target specifications in this syntax or the next can be combined with
persistent connections in an efficient way. For instance, what is to keep a
user from calling curl with, say,

curl -o a http://this/a.html -o b http://that/b.html -o c http://this/c.html

or some other combination of URLs that share several hosts in no particular
order. For the sake of connection-efficiency curl would be required to
perform out-of-order fetches of the specified set of URLs (sort according to
hosts), but wouldn't that possibly be confusing for a casual user?
Alternatively, the parser could forbid duplicate URLs pointing to the same
host on the curl command line, but again such a restriction feels a bit
clumsy.

... just my $.02.
        Jörn

P.S.: BTW, curl -O http://www.{this,that}.com/doc[1-10].html would work fine
with persistent connections because the existing urlglob iterates through
expressions from right to left.

> ...
>
> /Björn
>
Received on 2000-12-18