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