downloading multiple files using curl, curl repeats address in download

I am running the command

curl -O ""

but the download is failing. - the output is as follows

[1/10]: --> 1.png % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
100 531 0 531 0 0 1618 0 --:--:-- --:--:-- --:--:-- 1618

and the file 1.png has the following html:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body><script type="text/javascript">//<![CDATA[try{(function(a){var b="http://",c="",d="/cdn-cgi/cl/",e="img.gif",f=new a;f.src=[b,c,d,e].join("")})(Image)}catch(e){}//]]></script>
<h1>Not Found</h1>
<p>The requested URL /1http://w was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

looks like it is repeating the address at the end of the request - not sure why

Running the command for each file one at a time works

curl -O ""

note I have also tried

curl "" -o "#1.ext"

so Its not the -O option.

1

2 Answers

you could do with xargs or a simple for loop:

for i in `seq 0 9` ; do curl -O ""; done

EDIT: i didn't know you could use such syntax with curl... i tried and it works for me with your syntax, even without the -o parameter. (with curl 7.26.0)

I was able to do it with wget with your example:

wget 

aka in my real life test:

wget 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like