CURLOPT_POSTQUOTE.md (1785B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_POSTQUOTE 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_PREQUOTE (3) 9 - CURLOPT_QUOTE (3) 10 Protocol: 11 - FTP 12 - SFTP 13 Added-in: 7.1 14 --- 15 16 # NAME 17 18 CURLOPT_POSTQUOTE - (S)FTP commands to run after the transfer 19 20 # SYNOPSIS 21 22 ~~~c 23 #include <curl/curl.h> 24 25 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_POSTQUOTE, 26 struct curl_slist *cmds); 27 ~~~ 28 29 # DESCRIPTION 30 31 Pass a pointer to a linked list of FTP or SFTP commands to pass to the server 32 after your FTP transfer request. The commands are only issued if no error 33 occur. The linked list should be a fully valid list of struct curl_slist 34 structs properly filled in as described for CURLOPT_QUOTE(3). 35 36 Using this option multiple times makes the last set list override the previous 37 ones. Set it to NULL to disable its use again. 38 39 libcurl does not copy the list, it needs to be kept around until after the 40 transfer has completed. 41 42 # DEFAULT 43 44 NULL 45 46 # %PROTOCOLS% 47 48 # EXAMPLE 49 50 ~~~c 51 int 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 77 curl_easy_setopt(3) returns a CURLcode indicating success or error. 78 79 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 80 libcurl-errors(3).