curl-library
Re: Ask for help to get sftp home directory
Date: Tue, 7 Dec 2010 09:20:01 +0100 (CET)
On Tue, 7 Dec 2010, LIN Huangyang wrote:
> curl_easy_setopt(curl, CURLOPT_URL, my_url);
What is the URL in the SFTP case?
> Then I get below result in my console:
>
> ftp:
> 257 "/home/user_name" is current directory.
>
> sftp:
> 257 "/" is current directory.
Surely sftp didn't mention 257?
> But if I manually login to the remote server by ftp/sftp, then type "pwd", I
> get "/home/user_name" as current dir for both cases.
With libcurl you don't "login" to the site the same way your other clients
may and I think that adds to the confusion.
With libcurl you specify a URL to libcurl and that includes (an implied or
explicit) directory. Directory treatment of URLs is quite different in FTP
compared to SFTP URLs. In FTP you get the user's home directory by default if
you don't explicilty ask for an absolute directory, in SFTP you get the root
directory by default unless you explicilty ask for the user's home directory.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-12-07