I am trying to download two files by the following syntax:
curl -O http://domain/path/to/{file1,file2}
The problem is that only the first file is actually saved locally, and the second was simply printed to stdout.
I do realized that if I add a -O
it works just fine:
curl -OO http://domain/path/to/{file1,file2}
But isn't this impractical if the number of files grows too big? For example,
curl -O http://domain/path/to/file[1,100]
My question is, is there really no way to download multiple individual files at once with curl
(without adding a correct number of -O
)?
Best Answer
Update: This has been implemented in curl 7.19.0. See @Besworks answer.
According to the man page there is no way to keep the original file name except using multiple O´s. Alternatively you could use your own file names:
resulting in
http://one.site.com
being saved tofile_one.txt
andhttp://two.site.com
being saved tofile_two.txt
.or even multiple variables like
resulting in
http://site.host1.com
being saved tosite_1
,http://host.host1.com
being saved tohost_1
and so on.