GNURLOPT_FTP_FILEMETHOD(3)
π GNURLOPT_FTP_FILEMETHOD(3) π
okay bestie, this page is from the curl_easy_setopt options manual, and itβs all about telling libcurl how to reach a file on an FTP(S) server π«Ά
πΈ NAME πΈ
CURLOPT_FTP_FILEMETHOD β select directory traversing method for FTP β¨
π SYNOPSIS π
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_FILEMETHOD,
long method);
π DESCRIPTION π
You pass a long telling libcurl which method to use to reach a file on a FTP(S) server π
This option exists because some server implementations just arenβt compliant to what the standards say should work π
The argument should be one of these alternatives, no cap:
CURLFTPMETHOD_MULTICWDβ libcurl does a singleCWDoperation for each path part in the given URL. For deep hierarchies this means many commands. This is howRFC1738says it should be done. This is the default but the slowest behavior πCURLFTPMETHOD_NOCWDβ libcurl does noCWDat all. libcurl will doSIZE,RETR,STORetc and give a full path to the server for all these commands. This is the fastest behavior π₯CURLFTPMETHOD_SINGLECWDβ libcurl does oneCWDwith the full target directory and then operates on the file "normally" (like in the multicwd case). This is somewhat more standards compliant thannocwdbut without the full penalty ofmulticwdβ¨
π DEFAULT π
CURLFTPMETHOD_MULTICWD β yes, the slowest one, but thatβs the default, bestie π
π¦ PROTOCOLS π¦
FTP π
π EXAMPLE π
hereβs the code moment, copied exactly:
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/1/2/3/4/new.txt");
curl_easy_setopt(curl, CURLOPT_FTP_FILEMETHOD,
CURLFTPMETHOD_SINGLECWD);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
β AVAILABILITY β
Added in 7.15.1 π
π RETURN VALUE π
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not π
π§ SEE ALSO π§
okay bye bestie β this iconic little page is from libcurl 7.37.0, dated 19 Jun 2014, and itβs the GNURLOPT_FTP_FILEMETHOD(3) page πβ¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms