xref: /curl/docs/libcurl/opts/CURLOPT_POSTQUOTE.md (revision c4ab3337)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_POSTQUOTE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PREQUOTE (3)
9  - CURLOPT_QUOTE (3)
10Protocol:
11  - FTP
12  - SFTP
13Added-in: 7.1
14---
15
16# NAME
17
18CURLOPT_POSTQUOTE - (S)FTP commands to run after the transfer
19
20# SYNOPSIS
21
22~~~c
23#include <curl/curl.h>
24
25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTQUOTE,
26                          struct curl_slist *cmds);
27~~~
28
29# DESCRIPTION
30
31Pass a pointer to a linked list of FTP or SFTP commands to pass to the server
32after your FTP transfer request. The commands are only issued if no error
33occur. The linked list should be a fully valid list of struct curl_slist
34structs properly filled in as described for CURLOPT_QUOTE(3).
35
36Using this option multiple times makes the last set list override the previous
37ones. Set it to NULL to disable its use again.
38
39libcurl does not copy the list, it needs to be kept around until after the
40transfer has completed.
41
42# DEFAULT
43
44NULL
45
46# %PROTOCOLS%
47
48# EXAMPLE
49
50~~~c
51int main(void)
52{
53  struct curl_slist *cmdlist = NULL;
54  cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
55  cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
56
57  CURL *curl = curl_easy_init();
58  if(curl) {
59    CURLcode res;
60    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
61
62    /* pass in the FTP commands to run after the transfer */
63    curl_easy_setopt(curl, CURLOPT_POSTQUOTE, cmdlist);
64
65    res = curl_easy_perform(curl);
66
67    curl_easy_cleanup(curl);
68  }
69  curl_slist_free_all(cmdlist);
70}
71~~~
72
73# %AVAILABILITY%
74
75# RETURN VALUE
76
77Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
78