1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_QUOTE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_CUSTOMREQUEST (3) 9 - CURLOPT_DIRLISTONLY (3) 10 - CURLOPT_POSTQUOTE (3) 11 - CURLOPT_PREQUOTE (3) 12--- 13 14# NAME 15 16CURLOPT_QUOTE - (S)FTP commands to run before transfer 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUOTE, 24 struct curl_slist *cmds); 25~~~ 26 27# DESCRIPTION 28 29Pass a pointer to a linked list of FTP or SFTP commands to pass to the server 30prior to your request. This is done before any other commands are issued (even 31before the CWD command for FTP). The linked list should be a fully valid list 32of 'struct curl_slist' structs properly filled in with text strings. Use 33curl_slist_append(3) to append strings (commands) to the list, and clear 34the entire list afterwards with curl_slist_free_all(3). 35 36Disable this operation again by setting a NULL to this option. 37 38When speaking to an FTP server, prefix the command with an asterisk (*) to 39make libcurl continue even if the command fails as by default libcurl stops at 40first failure. 41 42The set of valid FTP commands depends on the server (see RFC 959 for a list of 43mandatory commands). 44 45libcurl does not inspect, parse or "understand" the commands passed to the 46server using this option. If you change connection state, working directory or 47similar using quote commands, libcurl does not know about it. 48 49The path arguments for FTP or SFTP can use single or double quotes to 50distinguish a space from being the parameter separator or being a part of the 51path. e.g. rename with sftp using a quote command like this: 52 53 "rename 'test/_upload.txt' 'test/Hello World.txt'" 54 55# SFTP commands 56 57## atime date file 58 59The atime command sets the last access time of the file named by the file 60operand. The <date expression> can be all sorts of date strings, see the 61curl_getdate(3) man page for date expression details. (Added in 7.73.0) 62 63## chgrp group file 64 65The chgrp command sets the group ID of the file named by the file operand to 66the group ID specified by the group operand. The group operand is a decimal 67integer group ID. 68 69## chmod mode file 70 71The chmod command modifies the file mode bits of the specified file. The 72mode operand is an octal integer mode number. 73 74## chown user file 75 76The chown command sets the owner of the file named by the file operand to the 77user ID specified by the user operand. The user operand is a decimal 78integer user ID. 79 80## ln source_file target_file 81 82The **ln** and **symlink** commands create a symbolic link at the 83target_file location pointing to the source_file location. 84 85## mkdir directory_name 86 87The mkdir command creates the directory named by the directory_name operand. 88 89## mtime date file 90 91The mtime command sets the last modification time of the file named by the 92file operand. The <date expression> can be all sorts of date strings, see the 93curl_getdate(3) man page for date expression details. (Added in 7.73.0) 94 95## pwd 96 97The **pwd** command returns the absolute path of the current working 98directory. 99 100## rename source target 101 102The rename command renames the file or directory named by the source 103operand to the destination path named by the target operand. 104 105## rm file 106 107The rm command removes the file specified by the file operand. 108 109## rmdir directory 110 111The rmdir command removes the directory entry specified by the directory 112operand, provided it is empty. 113 114## statvfs file 115 116The statvfs command returns statistics on the file system in which specified 117file resides. (Added in 7.49.0) 118 119## symlink source_file target_file 120 121See ln. 122 123# DEFAULT 124 125NULL 126 127# PROTOCOLS 128 129SFTP and FTP 130 131# EXAMPLE 132 133~~~c 134int main(void) 135{ 136 struct curl_slist *cmdlist = NULL; 137 cmdlist = curl_slist_append(cmdlist, "RNFR source-name"); 138 cmdlist = curl_slist_append(cmdlist, "RNTO new-name"); 139 140 CURL *curl = curl_easy_init(); 141 if(curl) { 142 CURLcode res; 143 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin"); 144 145 /* pass in the FTP commands to run before the transfer */ 146 curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist); 147 148 res = curl_easy_perform(curl); 149 150 curl_easy_cleanup(curl); 151 } 152} 153~~~ 154 155# AVAILABILITY 156 157SFTP support added in 7.16.3. *-prefix for SFTP added in 7.24.0 158 159# RETURN VALUE 160 161Returns CURLE_OK 162