curl / Mailing Lists / curl-library / Single Mail

curl-library

sftp working with option CURLOPT_DIRLISTONLY

From: via curl-library <curl-library_at_cool.haxx.se>
Date: Tue, 12 Mar 2019 18:05:19 +0800 (CST)

Hi,
I have code segments as following to get file list of a directory:
          curl_easy_setopt(curl,CURLOPT_USERPWD, "user:password");
          curl_easy_setopt(curl, CURLOPT_URL, "sftp://192.168.0.100:22/home/user/inbound/");
          curl_easy_setopt(curl, CURLOPT_FTPLISTONLY, 1);
          curl_easy_setopt(curl,CURLOPT_CUSTOMREQUEST, "nlst");
          curl_easy_perform(curl);

set "CURLOPT_FTPLISTONLY" to "1":
with request "nlst", both ftp and sftp only returns file names,
but for the request "list", ftp will return the file details including permission and size, and for sftp still only return file name.

set "CURLOPT_FTPLISTONLY" to "0":
with request "nlst", ftp only return file names, and sftp returns the details of the files in the directory
for the request "list", both ftp and sftp return the file details including permission and size.

Seems sftp does not obey the ftp command, and ftp does not obey the value of option "CURLOPT_FTPLISTONLY".

Any idea about this?

Regards,

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-03-12