1CURLOPT_QUOTE(3)           curl_easy_setopt options           CURLOPT_QUOTE(3)
2
3
4

NAME

6       CURLOPT_QUOTE - (S)FTP commands to run before transfer
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode    curl_easy_setopt(CURL    *handle,   CURLOPT_QUOTE,   struct
12       curl_slist *cmds);
13

DESCRIPTION

15       Pass a pointer to a linked list of FTP or SFTP commands to pass to  the
16       server  prior  to your request. This will be done before any other com‐
17       mands are issued (even before the CWD command for FTP). The linked list
18       should  be  a  fully valid list of 'struct curl_slist' structs properly
19       filled in with text strings. Use curl_slist_append(3) to append strings
20       (commands)  to  the  list,  and  clear  the entire list afterwards with
21       curl_slist_free_all(3). Disable this operation again by setting a  NULL
22       to this option. When speaking to an FTP server, prefix the command with
23       an asterisk (*) to make libcurl continue even if the command  fails  as
24       by default libcurl will stop at first failure.
25
26       The  set  of valid FTP commands depends on the server (see RFC959 for a
27       list of mandatory commands).
28
29       The valid SFTP commands are:
30
31              chgrp group file
32                     The chgrp command sets the group ID of the file named  by
33                     the  file  operand to the group ID specified by the group
34                     operand. The group operand is a decimal integer group ID.
35
36              chmod mode file
37                     The chmod command modifies the  file  mode  bits  of  the
38                     specified file. The mode operand is an octal integer mode
39                     number.
40
41              chown user file
42                     The chown command sets the owner of the file named by the
43                     file  operand  to the user ID specified by the user oper‐
44                     and. The user operand is a decimal integer user ID.
45
46              ln source_file target_file
47                     The ln and symlink commands create a symbolic link at the
48                     target_file  location  pointing  to the source_file loca‐
49                     tion.
50
51              mkdir directory_name
52                     The mkdir command creates  the  directory  named  by  the
53                     directory_name operand.
54
55              pwd    The pwd command returns the absolute pathname of the cur‐
56                     rent working directory.
57
58              rename source target
59                     The rename command renames the file or directory named by
60                     the  source  operand to the destination path named by the
61                     target operand.
62
63              rm file
64                     The rm command removes the file specified by the file op‐
65                     erand.
66
67              rmdir directory
68                     The  rmdir  command removes the directory entry specified
69                     by the directory operand, provided it is empty.
70
71              statvfs file
72                     The statvfs command returns statistics on the file system
73                     in which specified file resides. (Added in 7.49.0)
74
75              symlink source_file target_file
76                     See ln.
77

DEFAULT

79       NULL
80

PROTOCOLS

82       SFTP and FTP
83

EXAMPLE

85       struct curl_slist *cmdlist = NULL;
86       cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
87       cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
88
89       curl = curl_easy_init();
90       if(curl) {
91         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
92
93         /* pass in the FTP commands to run before the transfer */
94         curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist);
95
96         ret = curl_easy_perform(curl);
97
98         curl_easy_cleanup(curl);
99       }
100

AVAILABILITY

102       SFTP support added in 7.16.3. *-prefix for SFTP added in 7.24.0
103

RETURN VALUE

105       Returns CURLE_OK
106

SEE ALSO

108       CURLOPT_POSTQUOTE(3), CURLOPT_PREQUOTE(3),
109
110
111
112libcurl 7.69.1                 December 18, 2019              CURLOPT_QUOTE(3)
Impressum