CURLOPT_DIRLISTONLY.3 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. .\" generated by cd2nroff 0.1 from CURLOPT_DIRLISTONLY.md
  2. .TH CURLOPT_DIRLISTONLY 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_DIRLISTONLY \- ask for names only in a directory listing
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DIRLISTONLY, long listonly);
  9. .fi
  10. .SH DESCRIPTION
  11. For FTP and SFTP based URLs a parameter set to 1 tells the library to list the
  12. names of files in a directory, rather than performing a full directory listing
  13. that would normally include file sizes, dates etc.
  14. For POP3 a parameter of 1 tells the library to list the email message or
  15. messages on the POP3 server. This can be used to change the default behavior
  16. of libcurl, when combined with a URL that contains a message ID, to perform a
  17. \&"scan listing" which can then be used to determine the size of an email.
  18. For FILE, this option has no effect yet as directories are always listed in
  19. this mode.
  20. Note: For FTP this causes a NLST command to be sent to the FTP server. Beware
  21. that some FTP servers list only files in their response to NLST; they might
  22. not include subdirectories and symbolic links.
  23. Setting this option to 1 also implies a directory listing even if the URL
  24. does not end with a slash, which otherwise is necessary.
  25. Do not use this option if you also use \fICURLOPT_WILDCARDMATCH(3)\fP as it
  26. effectively breaks that feature.
  27. .SH DEFAULT
  28. 0, disabled
  29. .SH PROTOCOLS
  30. This functionality affects ftp, pop3 and sftp
  31. .SH EXAMPLE
  32. .nf
  33. int main(void)
  34. {
  35. CURL *curl = curl_easy_init();
  36. if(curl) {
  37. CURLcode res;
  38. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/");
  39. /* list only */
  40. curl_easy_setopt(curl, CURLOPT_DIRLISTONLY, 1L);
  41. res = curl_easy_perform(curl);
  42. curl_easy_cleanup(curl);
  43. }
  44. }
  45. .fi
  46. .SH HISTORY
  47. This option was known as CURLOPT_FTPLISTONLY up to 7.16.4. POP3 is supported
  48. since 7.21.5.
  49. .SH AVAILABILITY
  50. Added in curl 7.17.0
  51. .SH RETURN VALUE
  52. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  53. .SH SEE ALSO
  54. .BR CURLOPT_CUSTOMREQUEST (3),
  55. .BR CURLOPT_WILDCARDMATCH (3)