1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.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)
11Protocol:
12  - SFTP
13  - SCP
14  - FILE
15Added-in: 7.16.4
16---
17
18# NAME
19
20CURLOPT_NEW_DIRECTORY_PERMS - permissions for remotely created directories
21
22# SYNOPSIS
23
24~~~c
25#include <curl/curl.h>
26
27CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_DIRECTORY_PERMS,
28                          long mode);
29~~~
30
31# DESCRIPTION
32
33Pass a long as a parameter, containing the value of the permissions that is
34set 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
36this are *sftp://*, *scp://*, and *file://*.
37
38# DEFAULT
39
400755
41
42# %PROTOCOLS%
43
44# EXAMPLE
45
46~~~c
47int 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
65Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
66