CURLOPT_NEW_DIRECTORY_PERMS(3)
π CURLOPT_NEW_DIRECTORY_PERMS(3) π
okay bestie, welcome to the Library Functions Manual β this one's a libcurl page, and it's genuinely so useful if you're the kind of girl who makes folders on a remote server. which, apparently, we are now. π
β¨ NAME β¨
CURLOPT_NEW_DIRECTORY_PERMS β literally the permissions for directories that get created remotely π¦
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NEW_DIRECTORY_PERMS,
long mode);
β¨ DESCRIPTION β¨
so you pass a long as the parameter, and that value is the permissions that get set on newly created directories on the remote server. π«Ά
the default value is 0755, but ngl any valid value can be used. no gatekeeping here.
the only protocols that can use this are sftp://, scp://, and file://. that's the whole guest list, periodt. π
β¨ DEFAULT β¨
0755 β the blueprint, the standard, the main character default π
β¨ PROTOCOLS β¨
this functionality affects file, scp and sftp πΈ
β¨ EXAMPLE β¨
the way this little program just... does it. iconic. β¨
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL,
"sftp://upload.example.com/newdir/file.zip");
curl_easy_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L);
curl_easy_setopt(curl, CURLOPT_NEW_DIRECTORY_PERMS, 0644L);
result = curl_easy_perform(curl);
}
}
β¨ AVAILABILITY β¨
added in curl 7.16.4 β yes she's been around, she's a legacy icon π§
β¨ RETURN VALUE β¨
curl_easy_setopt(3) returns a CURLcode indicating success or error. π
CURLE_OK (0) means everything was OK β slay, no notes. non-zero means an error occurred, so go check libcurl-errors(3) and figure out what went wrong. π
β¨ SEE ALSO β¨
π quick vibe check: this option is about directories, not files β if you're after file perms, that's CURLOPT_NEW_FILE_PERMS(3) right up there in SEE ALSO. iykyk. π¦
okay that's the whole page, bestie β stay hydrated, set your perms, and remember: remote directories deserve cute permissions too. π
this has been libcurl, dated 2026-10-12 β mwah, catch you in the next manpage ππ
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms