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 dirs for FTP and SFTP
7

SYNOPSIS

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

DESCRIPTION

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

DEFAULT

41       CURLFTP_CREATE_DIR_NONE (0)
42

PROTOCOLS

44       FTP and SFTP
45

EXAMPLE

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

AVAILABILITY

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

RETURN VALUE

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

SEE ALSO

67       CURLOPT_FTP_FILEMETHOD(3), CURLOPT_FTP_USE_EPSV(3),
68
69
70
71libcurl 7.79.1                 November 04, 2C0U2R0LOPT_FTP_CREATE_MISSING_DIRS(3)
Impressum