cURL / Mailing Lists / curl-users / Single Mail

curl-users

url malformed error with simple curl usage

From: Scott Haneda <talklists_at_newgeo.com>
Date: Fri, 19 Mar 2010 20:47:59 -0700

Hello curl users,
This has bothered me in my usage (probably incorrect) for a long time.

Taking an image at a resource:
http://www.google.com/intl/en_ALL/images/logo.gif

I want to download that image, or compressed file, iso, whatever.

The man page states I have two options for this:
-o/--output <file>
-O/--remote-name

I would like to have the file downloaded and maintain the filename. According to the man page that means that -o is out, but -O is in:

       -O/--remote-name
              The remote file name to use for saving is extracted from the
              given URL, nothing else.

$cd ~/Downloads/
$curl -O http://www.google.com/intl/en_ALL/images/logo.gif
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 8558 100 8558 0 0 49177 0 --:--:-- --:--:-- --:--:-- 149k

$ls -la logo.gif
-rw-r--r-- 1 me-user staff 8558 Mar 19 20:35 logo.gif
$pwd
~/Downloads

That worked; downloaded the file to the current working directory and kept the file name. But what if I want to download the file to some other location?

$curl http://www.google.com/intl/en_ALL/images/logo.gif -O ~/Desktop
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 8558 100 8558 0 0 62538 0 --:--:-- --:--:-- --:--:-- 146k
curl: (3) <url> malformed

I have tried several variations, none of which I can get to work. The best I can do is:
$cd ~/Someplace; curl -O http://www.google.com/intl/en_ALL/images/logo.gif

Is this not possible in one command?
Thank you for any pointers.

-- 
Scott * If you contact me off list replace talklists@ with scott@ * 
-------------------------------------------------------------------
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 2010-03-20