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