cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: url malformed error with simple curl usage

From: Doug McNutt <douglist_at_macnauchtan.com>
Date: Sat, 20 Mar 2010 14:34:26 -0600

At 20:47 +0100 3/20/10, Kamil Dudka wrote:
>Sure, doing so in a subshell might be also good idea:
>
>$ (cd ~/Desktop && curl -O ...)

** How about making curl behave more like cp or scp when the specified destination is a directory?

curl http://something .com/with/subdirectories/wanted_file -o $HOME/Downloads/

really ought never to replace the Downloads directory with a file but actually I think it will unless it encounters permission problems on the directory.

scp or cp will create a new file wanted_file in HOME/Downloads/. No o or O required.

** There is a provision for transmitting multiple files with [ ] grep-like matching which I always have to look up in the man page:"

curl http://something .com/with/subdirectories/[wanted_file] -o $HOME/Downloads/[1]

just might work.

** Of course one can define a shell variable that is the file name.
#!csh
set what=wanted_file
curl http://something .com/with/subdirectories/$what -o $HOME/Downloads/$what

If you're going to do other similar downloads saving that script in a shell-enabled text editor (BBEdit, MPW, gedit) will allow repeated executions without changing the curl command line.

-- 
--> A fair tax is one that you pay but I don't <--
-------------------------------------------------------------------
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