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