1CURLOPT_FTP_CREATE_MISSING_DcIuRrSl(_3e)asy_setopt oCpUtRiLoOnPsT_FTP_CREATE_MISSING_DIRS(3)
2
3
4

NAME

6       CURLOPT_FTP_CREATE_MISSING_DIRS  -  create  missing directories for FTP
7       and SFTP
8

SYNOPSIS

10       #include <curl/curl.h>
11
12       typedef enum {
13         CURLFTP_CREATE_DIR_NONE,
14         CURLFTP_CREATE_DIR,
15         CURLFTP_CREATE_DIR_RETRY
16       } curl_ftpcreatedir;
17
18       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_CREATE_MISSING_DIRS,
19                                 long create);
20

DESCRIPTION

22       Pass a long telling  libcurl  to  create  the  dir.  If  the  value  is
23       CURLFTP_CREATE_DIR  (1),  libcurl will attempt to create any remote di‐
24       rectory that it fails to "move" into.
25
26       For FTP requests, that means a CWD command fails. CWD being the command
27       that changes working directory.
28
29       For  SFTP requests, libcurl will attempt to create the remote directory
30       if it cannot obtain a handle to the target-location. The creation  will
31       fail  if a file of the same name as the directory to create already ex‐
32       ists or lack of permissions prevents creation.
33
34       Setting create to CURLFTP_CREATE_DIR_RETRY (2), tells libcurl to  retry
35       the  CWD command again if the subsequent MKD command fails. This is es‐
36       pecially useful if you are doing many simultaneous connections  against
37       the  same server and they all have this option enabled, as then CWD may
38       first fail but then another connection does MKD before this  connection
39       and thus MKD fails but trying CWD works!
40

DEFAULT

42       CURLFTP_CREATE_DIR_NONE (0)
43

PROTOCOLS

45       FTP and SFTP
46

EXAMPLE

48       CURL *curl = curl_easy_init();
49       if(curl) {
50         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/non-existing/new.txt");
51         curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
52                          (long)CURLFTP_CREATE_DIR_RETRY);
53
54         ret = curl_easy_perform(curl);
55
56         curl_easy_cleanup(curl);
57       }
58

AVAILABILITY

60       Added  in  7.10.7.  SFTP  support added in 7.16.3. The retry option was
61       added in 7.19.4.
62

RETURN VALUE

64       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
65       if the create value is not.
66

SEE ALSO

68       CURLOPT_FTP_FILEMETHOD(3), CURLOPT_FTP_USE_EPSV(3),
69
70
71
72libcurl 8.0.1                  January 02, 20C2U3RLOPT_FTP_CREATE_MISSING_DIRS(3)
Impressum