1

I am running the command

curl -O "http://www.*site*.com/[1-9].png"

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

[1/10]: http://www.*site*.com/1http://w --> 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="www.*site*.com",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 "http://www.*site*.com/1.png"

note I have also tried

curl "http://www.*site*.com/[1-9].png" -o "#1.ext"

so Its not the -O option.

0

you could do with xargs or a simple for loop:

for i in `seq 0 9` ; do curl -O "http://www.*site*.com/$i.png"; 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)

0

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

wget http://www.*site*.com/[1-9].png

aka in my real life test:

wget https://raw.githubusercontent.com/jodumont/configFile/master/etc/mysql/conf.d/{docker,mysql,mysqld,mysqld_safe_syslog}.cnf

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.