cURL / Mailing Lists / curl-users / Single Mail


Re: download image without direct link

From: Doug McNutt <>
Date: Sat, 9 Apr 2011 10:25:52 -0600

At 11:31 -0400 4/9/11, Ralph Mitchell wrote:
On Sat, Apr 9, 2011 at 5:50 AM, Dmitry ? <<>> wrote:

Oh, it was needed to write "-O" in up case.
But even with it file is loading corrupted.

./curl.exe -O "<>" > "C:\temp\foo.gif"
will save foo.gif in folder C:\temp\ with null size.
But there would be another file in curl location (C:\curl\) named "h-image.ashx_region=eu&time=201104091000&ir=False" that's may be viewed if rename in to gif.

That's because the -O option tells curl to use the last part of the url as the file name. What you'll see in foo.gif is ay text output generated by curl. What you need is:

     curl.exe -o foo.gif "<http://sat106.>http://sat106......"

I find it a PITA to have to enter the file name twice for that. Yeah it's a bit silly. But I have had some luck using curl's "#1" notation intended for use with sequenced files where multiple downloads in a single line are needed. The idea is that you can use [001-023] notation in the URL and refer to the file name with #1, #2 in the -o option to get the right names for stored files. {one,two} works the same way.

I have had some luck with this kind of thing:

/usr/bin/ curl -o $HOME/dwn/eu_#1.jpeg "<>{201104091000}&ir=False"

which allows creation of a meaningful file name from a single entry. Note the Linux shell though. I have zero experience in the C:\ world. I'm also not so sure that the code is intended to work for a single instance that way.

--> Protons have mass? I didn't even know they were Catholic. <--
List admin:
Received on 2011-04-09