cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Setting Local Directory for an ftpget

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 19 Dec 2011 15:40:02 +0100 (CET)

On Mon, 19 Dec 2011, SuperManager Customer Support wrote:

Please stop top-posting.

> Note that I am using the wildcard ftpget example.

Oh. It makes thing slightly different, but not much.

> Perhaps it varies from the regular ftp example. I need to know how to set a
> directory name in front of the filename when opening the file.

When that callback is called, you know what URL you used - and you know the
particular single file name since that is set within the fileinfo struct.

Your code simple needs to figure out what directory name to prepend to the
file names you get.

> As I tried to explain, but perhaps didn't do well was that I need to be able
> to specify that directory at runtime rather than compile it into the code.

The same general idea applies in this callback though. It gives you
information, you need to handle it and convert it to what you think is
necessary.

Also note that the wildcard thing is only listing the files, it doesn't
actually transfer their contents. You probably want to store all files in a
list/array somewhere and after you've received the entire list you ask for the
files you'd like to get.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-19