1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_FTP_FILEMETHOD 5Section: 3 6Source: libcurl 7Protocol: 8 - FTP 9See-also: 10 - CURLOPT_DIRLISTONLY (3) 11 - CURLOPT_FTP_SKIP_PASV_IP (3) 12--- 13 14# NAME 15 16CURLOPT_FTP_FILEMETHOD - select directory traversing method for FTP 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_FILEMETHOD, 24 long method); 25~~~ 26 27# DESCRIPTION 28 29Pass a long telling libcurl which *method* to use to reach a file on a 30FTP(S) server. 31 32This option exists because some server implementations are not compliant to 33what the standards say should work. 34 35The argument should be one of the following alternatives: 36 37## CURLFTPMETHOD_MULTICWD 38 39libcurl does a single CWD operation for each path part in the given URL. For 40deep hierarchies this means many commands. This is how RFC 1738 says it should 41be done. This is the default but the slowest behavior. 42 43## CURLFTPMETHOD_NOCWD 44 45libcurl makes no CWD at all. libcurl does SIZE, RETR, STOR etc and gives a 46full path to the server for all these commands. This is the fastest behavior 47since it skips having to change directories. 48 49## CURLFTPMETHOD_SINGLECWD 50 51libcurl does one CWD with the full target directory and then operates on the 52file &"normally" (like in the multicwd case). This is somewhat more standards 53compliant than 'nocwd' but without the full penalty of 'multicwd'. 54 55# DEFAULT 56 57CURLFTPMETHOD_MULTICWD 58 59# EXAMPLE 60 61~~~c 62int main(void) 63{ 64 CURL *curl = curl_easy_init(); 65 if(curl) { 66 CURLcode res; 67 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/1/2/3/4/new.txt"); 68 curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, 69 (long)CURLFTPMETHOD_SINGLECWD); 70 71 res = curl_easy_perform(curl); 72 73 curl_easy_cleanup(curl); 74 } 75} 76~~~ 77 78# AVAILABILITY 79 80Added in 7.15.1 81 82# RETURN VALUE 83 84Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 85