cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Error running curl and brackets for sequential urls

From: Leif W <warp9pnt9_at_gmail.com>
Date: Thu, 5 Nov 2015 03:08:58 -0500

On 2015-11-05 00:51, David Straub via curl-users wrote:
> C:\Curl>curl
> "http://xuexiao.eol.cn/html4/1100/1140000[01-99]/index.shtml" -o #.html
>
> When I run this code, rather than create a sequential url, the bracket
> is replaced by the beginning of the url, like this:
>
> C:\Curl>curl
> "http://xuexiao.eol.cn/html4/1100/1140000[01-10]/index.shtml" -o #.html
>
> [1/11]: http://xuexiao.eol.cn/html4/1100/114000001http://xuexiao.eo -->

Hello, thought I'd try my local curl and see what happens. My
experience is limited so I can only offer some tests and observations.

First question: what version are you using?

[ 2:40:49] E:\ -> curl --version
curl 7.21.7 (amd64-pc-win32) libcurl/7.21.7 OpenSSL/0.9.8r zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3
pop3s rtsp
smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate Largefile NTLM SSL SSPI libz

I have a very old version apparently, but it doesn't reproduce the same
behavior. If I try your exact same version and see the same problem,
that may give insight to someone else who maybe can help further.

[ 2:39:49] E:\ -> curl
"http://xuexiao.eol.cn/html4/1100/1140000[01-99]/index.shtml" -o #.html

[1/5]: http://xuexiao.eol.cn/html4/1100/114000001/index.shtml --> #.html
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:08 --:--:-- 0

[2/5]: http://xuexiao.eol.cn/html4/1100/114000002/index.shtml --> #.html
0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0

The only problem I can point out with your command line is the #.html
parameter needs to be #1.html whereby #1 is replaced with each of the
sequential #s of the first set of bracket [] define ranges. Without a
number to indicate which bracket sequence you are referring to, it
simply uses # as a literal character and all files are given the name
#.html, clobbering all but the final request. Presumably, multiple []
ranges can be referenced as #2 #3 #4 etc, but I have not tested that
assumption.

Corrected Example:

[ 2:57:20] E:\ -> curl
"http://xuexiao.eol.cn/html4/1100/1140000[01-99]/index.shtml" -o #1.html

[1/99]: http://xuexiao.eol.cn/html4/1100/114000001/index.shtml --> 01.html
   % Total % Received % Xferd Average Speed Time Time Time
  Current
                                  Dload Upload Total Spent Left
  Speed
   0 0 0 0 0 0 0 0 --:--:-- 0:00:02
--:--:-- 0

[2/99]: http://xuexiao.eol.cn/html4/1100/114000002/index.shtml --> 02.html
   0 0 0 0 0 0 0 0 --:--:-- 0:00:01
--:--:-- 0

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-11-05