CURLOPT_NEW_DIRECTORY_PERMS.3 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. .\" generated by cd2nroff 0.1 from CURLOPT_NEW_DIRECTORY_PERMS.md
  2. .TH CURLOPT_NEW_DIRECTORY_PERMS 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_NEW_DIRECTORY_PERMS \- permissions for remotely created directories
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_DIRECTORY_PERMS,
  9. long mode);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a long as a parameter, containing the value of the permissions that is
  13. set on newly created directories on the remote server. The default value is
  14. \fI0755\fP, but any valid value can be used. The only protocols that can use
  15. this are \fIsftp://\fP, \fIscp://\fP, and \fIfile://\fP.
  16. .SH DEFAULT
  17. 0755
  18. .SH PROTOCOLS
  19. This functionality affects file, scp and sftp
  20. .SH EXAMPLE
  21. .nf
  22. int main(void)
  23. {
  24. CURL *curl = curl_easy_init();
  25. if(curl) {
  26. CURLcode ret;
  27. curl_easy_setopt(curl, CURLOPT_URL,
  28. "sftp://upload.example.com/newdir/file.zip");
  29. curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);
  30. curl_easy_setopt(curl, CURLOPT_NEW_DIRECTORY_PERMS, 0644L);
  31. ret = curl_easy_perform(curl);
  32. }
  33. }
  34. .fi
  35. .SH AVAILABILITY
  36. Added in curl 7.16.4
  37. .SH RETURN VALUE
  38. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  39. .SH SEE ALSO
  40. .BR CURLOPT_FTP_CREATE_MISSING_DIRS (3),
  41. .BR CURLOPT_NEW_FILE_PERMS (3),
  42. .BR CURLOPT_UPLOAD (3)