CURLOPT_FTP_CREATE_MISSING_DIRS.3 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2014, 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_FTP_CREATE_MISSING_DIRS 3 "19 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_FTP_CREATE_MISSING_DIRS \- create missing dirs for FTP and SFTP
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. typedef enum {
  30. CURLFTP_CREATE_DIR_NONE,
  31. CURLFTP_CREATE_DIR,
  32. CURLFTP_CREATE_DIR_RETRY
  33. } curl_ftpcreatedir;
  34. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTP_CREATE_MISSING_DIRS,
  35. long create);
  36. .SH DESCRIPTION
  37. Pass a long telling libcurl to \fIcreate\fP the dir. If the value is
  38. \fICURLFTP_CREATE_DIR\fP (1), libcurl will attempt to create any remote
  39. directory that it fails to "move" into.
  40. For FTP requests, that means a CWD command fails. CWD being the command that
  41. changes working directory.
  42. For SFTP requests, libcurl will attempt to create the remote directory if it
  43. can't obtain a handle to the target-location. The creation will fail if a file
  44. of the same name as the directory to create already exists or lack of
  45. permissions prevents creation.
  46. Setting \fIcreate\fP to \fICURLFTP_CREATE_DIR_RETRY\fP (2), tells libcurl to
  47. retry the CWD command again if the subsequent MKD command fails. This is
  48. especially useful if you're doing many simultaneous connections against the
  49. same server and they all have this option enabled, as then CWD may first fail
  50. but then another connection does MKD before this connection and thus MKD fails
  51. but trying CWD works!
  52. .SH DEFAULT
  53. CURLFTP_CREATE_DIR_NONE (0)
  54. .SH PROTOCOLS
  55. FTP and SFTP
  56. .SH EXAMPLE
  57. .nf
  58. CURL *curl = curl_easy_init();
  59. if(curl) {
  60. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/non-existing/new.txt");
  61. curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
  62. CURLFTP_CREATE_DIR_RETRY);
  63. ret = curl_easy_perform(curl);
  64. curl_easy_cleanup(curl);
  65. }
  66. .fi
  67. .SH AVAILABILITY
  68. Added in 7.10.7. SFTP support added in 7.16.3. The retry option was added in
  69. 7.19.4.
  70. .SH RETURN VALUE
  71. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if the
  72. create value is not.
  73. .SH "SEE ALSO"
  74. .BR CURLOPT_FTP_FILEMETHOD "(3), " CURLOPT_FTP_USE_EPSV "(3), "