• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15---
16
17# NAME
18
19CURLOPT_NEW_DIRECTORY_PERMS - permissions for remotely created directories
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_DIRECTORY_PERMS,
27                          long mode);
28~~~
29
30# DESCRIPTION
31
32Pass a long as a parameter, containing the value of the permissions that is
33set on newly created directories on the remote server. The default value is
34*0755*, but any valid value can be used. The only protocols that can use
35this are *sftp://*, *scp://*, and *file://*.
36
37# DEFAULT
38
390755
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