CURLOPT_NEW_DIRECTORY_PERMS.md (1449B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_NEW_DIRECTORY_PERMS 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_FTP_CREATE_MISSING_DIRS (3) 9 - CURLOPT_NEW_FILE_PERMS (3) 10 - CURLOPT_UPLOAD (3) 11 Protocol: 12 - SFTP 13 - SCP 14 - FILE 15 Added-in: 7.16.4 16 --- 17 18 # NAME 19 20 CURLOPT_NEW_DIRECTORY_PERMS - permissions for remotely created directories 21 22 # SYNOPSIS 23 24 ~~~c 25 #include <curl/curl.h> 26 27 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_DIRECTORY_PERMS, 28 long mode); 29 ~~~ 30 31 # DESCRIPTION 32 33 Pass a long as a parameter, containing the value of the permissions that is 34 set on newly created directories on the remote server. The default value is 35 *0755*, but any valid value can be used. The only protocols that can use 36 this are *sftp://*, *scp://*, and *file://*. 37 38 # DEFAULT 39 40 0755 41 42 # %PROTOCOLS% 43 44 # EXAMPLE 45 46 ~~~c 47 int main(void) 48 { 49 CURL *curl = curl_easy_init(); 50 if(curl) { 51 CURLcode ret; 52 curl_easy_setopt(curl, CURLOPT_URL, 53 "sftp://upload.example.com/newdir/file.zip"); 54 curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L); 55 curl_easy_setopt(curl, CURLOPT_NEW_DIRECTORY_PERMS, 0644L); 56 ret = curl_easy_perform(curl); 57 } 58 } 59 ~~~ 60 61 # %AVAILABILITY% 62 63 # RETURN VALUE 64 65 curl_easy_setopt(3) returns a CURLcode indicating success or error. 66 67 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 68 libcurl-errors(3).