1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_POSTQUOTE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PREQUOTE (3)
9  - CURLOPT_QUOTE (3)
10---
11
12# NAME
13
14CURLOPT_POSTQUOTE - (S)FTP commands to run after the transfer
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTQUOTE,
22                          struct curl_slist *cmds);
23~~~
24
25# DESCRIPTION
26
27Pass a pointer to a linked list of FTP or SFTP commands to pass to the server
28after your FTP transfer request. The commands are only issues if no error
29occur. The linked list should be a fully valid list of struct curl_slist
30structs properly filled in as described for CURLOPT_QUOTE(3).
31
32Disable this operation again by setting a NULL to this option.
33
34# DEFAULT
35
36NULL
37
38# PROTOCOLS
39
40SFTP and FTP
41
42# EXAMPLE
43
44~~~c
45int main(void)
46{
47  struct curl_slist *cmdlist = NULL;
48  cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
49  cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
50
51  CURL *curl = curl_easy_init();
52  if(curl) {
53    CURLcode res;
54    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
55
56    /* pass in the FTP commands to run after the transfer */
57    curl_easy_setopt(curl, CURLOPT_POSTQUOTE, cmdlist);
58
59    res = curl_easy_perform(curl);
60
61    curl_easy_cleanup(curl);
62  }
63}
64~~~
65
66# AVAILABILITY
67
68If support for the protocols are built-in.
69
70# RETURN VALUE
71
72Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
73