CURLOPT_FTP_FILEMETHOD.3 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. .\" generated by cd2nroff 0.1 from CURLOPT_FTP_FILEMETHOD.md
  2. .TH CURLOPT_FTP_FILEMETHOD 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_FTP_FILEMETHOD \- select directory traversing method for FTP
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_FILEMETHOD,
  9. long method);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a long telling libcurl which \fImethod\fP to use to reach a file on a
  13. FTP(S) server.
  14. This option exists because some server implementations are not compliant to
  15. what the standards say should work.
  16. The argument should be one of the following alternatives:
  17. .IP CURLFTPMETHOD_MULTICWD
  18. libcurl does a single CWD operation for each path part in the given URL. For
  19. deep hierarchies this means many commands. This is how RFC 1738 says it should
  20. be done. This is the default but the slowest behavior.
  21. .IP CURLFTPMETHOD_NOCWD
  22. libcurl makes no CWD at all. libcurl does SIZE, RETR, STOR etc and gives a
  23. full path to the server for all these commands. This is the fastest behavior
  24. since it skips having to change directories.
  25. .IP CURLFTPMETHOD_SINGLECWD
  26. libcurl does one CWD with the full target directory and then operates on the
  27. file &"normally" (like in the multicwd case). This is somewhat more standards
  28. compliant than \(aqnocwd\(aq but without the full penalty of \(aqmulticwd\(aq.
  29. .SH DEFAULT
  30. CURLFTPMETHOD_MULTICWD
  31. .SH PROTOCOLS
  32. This functionality affects ftp only
  33. .SH EXAMPLE
  34. .nf
  35. int main(void)
  36. {
  37. CURL *curl = curl_easy_init();
  38. if(curl) {
  39. CURLcode res;
  40. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/1/2/3/4/new.txt");
  41. curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD,
  42. (long)CURLFTPMETHOD_SINGLECWD);
  43. res = curl_easy_perform(curl);
  44. curl_easy_cleanup(curl);
  45. }
  46. }
  47. .fi
  48. .SH AVAILABILITY
  49. Added in curl 7.15.1
  50. .SH RETURN VALUE
  51. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  52. .SH SEE ALSO
  53. .BR CURLOPT_DIRLISTONLY (3),
  54. .BR CURLOPT_FTP_SKIP_PASV_IP (3)