curl download multiple files with brace syntax

I realize that there is already an accepted answer to this question but I feel I should point out that there actually is a way to do this.

The --remote-name-all option tells curl to behave as if you used -O or --remote-name for each file.

https://curl.haxx.se/docs/manpage.html#--remote-name-all

This option has been available since version 7.19.0

https://curl.haxx.se/changes.html#7_19_0


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:

curl http://{one,two}.site.com -o "file_#1.txt"

resulting in http://one.site.com being saved to file_one.txt and http://two.site.com being saved to file_two.txt.

or even multiple variables like

curl http://{site,host}.host[1-5].com -o "#1_#2"

resulting in http://site.host1.com being saved to site_1, http://host.host1.com being saved to host_1 and so on.

Tags:

Curl