CURLOPT_POSTQUOTE(3)
CURLOPT_POSTQUOTE(3) π
okay bestie, welcome to the Library Functions Manual β this page is your group-chat cheat sheet for CURLOPT_POSTQUOTE. It's giving βcommands to run after the transfer,β and yes, it's lowkey iconic. β¨
πΈ NAME πΈ
CURLOPT_POSTQUOTEβ (S)FTP commands to run after the transfer
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTQUOTE,
struct curl_slist *cmds);
π¦ DESCRIPTION π¦
So here's the vibe: you pass a pointer to a linked list of FTP or SFTP commands, and those commands get passed to the server after your FTP transfer request. The commands are only issued if no error occurs β no cap.
The linked list should be a fully valid list of struct curl_slist structs, properly filled in as described for CURLOPT_QUOTE(3). Keep that reference handy, iykyk. π
Using this option multiple times makes the last set list override the previous ones. Set it to NULL to disable its use again.
π«Ά Heads up: libcurl does not copy the list. You need to keep it around until after the transfer has completed. Don't let your list ghost the transfer early, bestie. π
π DEFAULT π
NULL β that's the default. No post-transfer command list unless you set one.
π PROTOCOLS π
This functionality affects ftp and sftp. Periodt. π
π EXAMPLE π
Here's the exact example, no cap:
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 after the transfer */
curl_easy_setopt(curl, CURLOPT_POSTQUOTE, cmdlist);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
curl_slist_free_all(cmdlist);
}
β AVAILABILITY β
Added in curl 7.1. Vintage but still slaying. π
π 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 π§
mwah π β libcurl Β· 2026-10-12 Β· CURLOPT_POSTQUOTE(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