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