cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Download file and store in a different directory

From: Doug McNutt <douglist_at_macnauchtan.com>
Date: Thu, 10 Feb 2011 15:53:11 -0700

At 22:14 +0100 2/10/11, Daniel Stenberg wrote:
>On Thu, 10 Feb 2011, Lee Elcocks wrote:
>
>> I need to download a file from server, and put the file in a different directory, i think this is done woth the -o command, is this correct?
>>
>> I.E. -o C:\test\downloadedfiles\
>
>-o needs to specify the full target file name, not just the directory.

IE

cd C:\test\downloadedfiles\ ; curl -O http. . .

But then I really don't understand that C: stuff. The semicolon means immediately start the second command right after the change directory command. The capital O asks curl to get the short name from the URL and use it in the current working directory.

You might also have a look at curl's {1,2] notation that would let you do things like:

curl -o /home/downloads/file#1 http://somedomain/somedirectory/file[1,2]

where the # refers to first the 1 and then the 2 in the brackets to download multiple files. And be careful. I may have that syntax wrong. It's in the man page. Could that be faked to put a single file between the brackets and just #1 in the -o argument? Perhaps.

-- 
--> From the U S of A, the only socialist country that refuses to admit it. <--
-------------------------------------------------------------------
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 2011-02-10