CURLOPT_QUOTE(3)
π CURLOPT_QUOTE(3) π
okay bestie, this is CURLOPT_QUOTE(3) from the Library Functions Manual β the (S)FTP-commands-to-run-before-transfer one β and we're gonna keep every deet, no cap. π«Άβ¨
πΈ NAME πΈ
CURLOPT_QUOTE β (S)FTP commands to run before transfer.
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUOTE,
struct curl_slist *cmds);
π DESCRIPTION π
okay so you pass a pointer to a linked list of FTP or SFTP commands to pass to the server prior to your request. This happens before any other commands are issued β even before the CWD command for FTP, bestie. π The linked list should be a fully valid list of struct curl_slist structs properly filled in with text strings. Use curl_slist_append(3) to append strings (commands) to the list, and clear the entire list afterwards with curl_slist_free_all(3).
Using this option multiple times makes the last set list override the previous ones. Set it to NULL to disable its use again. And important: libcurl does not copy the list β it needs to be kept around until after the transfer has completed. Keep that list alive, bestie. π«Ά
When speaking to an FTP server, prefix the command with an asterisk (*) to make libcurl continue even if the command fails, since by default libcurl stops at first failure. The set of valid FTP commands depends on the server (see RFC 959 for a list of mandatory commands).
Big caveat time: libcurl does not inspect, parse or "understand" the commands passed to the server using this option. If you change connection state, working directory or similar using quote commands, libcurl does not know about it. π
The path arguments for FTP or SFTP should use double quotes to distinguish a space from being the parameter separator or being a part of the path. For example, rename with sftp using a quote command like this:
rename "test/_upload.txt" "test/Hello World.txt"
For SFTP, filenames must be provided within double quotes to embed spaces, backslashes, quotes or double quotes. Within double quotes the following escape sequences are available for that purpose: \, π
π§ SFTP commands π§
okay bestie, here are the SFTP commands with their exact signatures and operands:
atime date fileβ theatimecommand sets the last access time of the file named by thefileoperand. Thedateexpression can be all sorts of date strings, see thecurl_getdate(3)man page for date expression details. (Added in7.73.0)chgrp group fileβ thechgrpcommand sets the group ID of the file named by thefileoperand to the group ID specified by thegroupoperand. Thegroupoperand is a decimal integer group ID.chmod mode fileβ thechmodcommand modifies the file mode bits of the specified file. Themodeoperand is an octal integer mode number.chown user fileβ thechowncommand sets the owner of the file named by thefileoperand to the user ID specified by theuseroperand. Theuseroperand is a decimal integer user ID.ln source_file target_fileβ thelnandsymlinkcommands create a symbolic link at thetarget_filelocation pointing to thesource_filelocation.mkdir directory_nameβ themkdircommand creates the directory named by thedirectory_nameoperand.mtime date fileβ themtimecommand sets the last modification time of the file named by thefileoperand. Thedateexpression can be all sorts of date strings, see thecurl_getdate(3)man page for date expression details. (Added in7.73.0)pwdβ thepwdcommand returns the absolute path of the current working directory.rename source targetβ therenamecommand renames the file or directory named by thesourceoperand to the destination path named by thetargetoperand.rm fileβ thermcommand removes the file specified by thefileoperand.rmdir directoryβ thermdircommand removes the directory entry specified by thedirectoryoperand, provided it is empty.statvfs fileβ thestatvfscommand returns statistics on the file system in which specified file resides.symlink source_file target_fileβ seeln.
π DEFAULT π
NULL β that's the default, bestie. π«Ά
π PROTOCOLS π
This functionality affects ftp and sftp.
π EXAMPLE π
okay here's the exact example β no edits, just the code:
int main(void)
{
struct curl_slist *cmdlist = NULL;
cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
/* pass in the FTP commands to run before the transfer */
curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
curl_slist_free_all(cmdlist);
}
β HISTORY β
SFTP support added in 7.16.3. *-prefix for SFTP added in 7.24.0.
π AVAILABILITY π
Added in curl 7.1.
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).
π₯ SEE ALSO π₯
kisses and sparkles, bestie πβ¨ β this page is from libcurl, dated 2026-10-12, and it's CURLOPT_QUOTE(3). π«Ά
π¦ 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