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