curl-library
Re: CURLOPT_CREATE_MISSING_DIRS and empty folders
Date: Sun, 19 Feb 2006 14:21:05 +0100 (CET)
On Sun, 19 Feb 2006, Silex wrote:
> Say I have a file tree like this that I want to upload:
>
> foo/a.txt
> foo/b.txt
> bar/
> x.txt
> y.txt
>
> So, for a.txt, b.txt, x.txt and y.txt I just set the url like
> ftp://server.com/foo/a.txt with the option CREATE_MISSING_DIRS and UPLOAD
> and I perform() and the directory foo is created and everyone is happy etc.
>
> Now for the bar directory, what am I supposed to do ?
Ah, ok. I'm starting to understand what you've been saying all the time! ;-)
If you only want to create a directory on the serverm then of course NOBODY
should be used, as otherwise it expects a transfer to be done and based on
your info, I don't think you want that.
However, I don't see any good reason to create the 'bar' dir unless there is
any file in it, and if there is one or more files in it you can simply send
them and ignore the "dir-only" case.
> From our discussion, I understand I should do smth like set the url to
> ftp://server.com/bar/ then set the options CREATE_MISSING_DIRS and NOBODY ?
> Did I get it right ?
Yes.
I think libcurl should return an error if you try to upload (without NOBODY
set to non-zero) when the URL has no file part.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2006-02-19