cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SFTP create missing directories

From: James Housley <jim_at_thehousleys.net>
Date: Tue, 12 Jun 2007 10:42:34 -0400

On Jun 12, 2007, at 10:17 AM, Daniel Stenberg wrote:

> On Tue, 12 Jun 2007, James Housley wrote:
>
>> So following that precedent, I would like to do a
>> libssh2_sftp_opendir() to see if the directory exists. I believe
>> that should give a definitive answer about the existence of the
>> destination directory. If it doesn't exist, the call the
>> sftp_create_dirs() routine. Then try the libssh2_sftp_open() to
>> start the upload.
>>
>> How does that sound?
>
> It does provide the most proper solution that will make libcurl not
> attempt to create a dir just because it failed for other reasons,
> but on the other hand it'll use quite a lot of more time and
> roundtrips if there's a really deep dir hiearchy to traverse...
>

My other question is what will creating an existing directory do on
the remote end? Could it change the owner? Could it change the
permissions? Not creating is very safe.

> I'm not sure the benefits outweights the downside of the slower
> operation. But I don't feel strongly for either way so if your
> poking on this I'm fine to let you pick the way you like.

I think I will use opendir because I feel the results will be better
defined. But I have testing to do, one question is if we want to
upload to a directory "something", but there already is a file called
"something"....

Jim

--
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
jeh@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
In theory there is no difference between theory and practice.
In practice there is no similarity.
       -- From the "I wish I'd said that" archives.
Received on 2007-06-12