cURL / Mailing Lists / curl-library / Single Mail


Re: SFTP create missing directories

From: Daniel Stenberg <>
Date: Tue, 12 Jun 2007 16:17:58 +0200 (CEST)

On Tue, 12 Jun 2007, James Housley wrote:

> The FTP code walks each directory before upload and downloads, not as
> efficient as a single change directory (but I understand why).

The FTP code has different ways to change directories. The one-at-a-time
approach is done by default simply because it is mandated by a spec.

> 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...

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.

> On a side note, the patch uses index() but isn't strchr() more widely
> supported?

Exactly, we should use strchr().

  Commercial curl and libcurl Technical Support:
Received on 2007-06-12