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,
12                                 struct 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).
22
23       Disable this operation again by setting a NULL to this option.
24
25       When speaking to an FTP server, prefix the command with an asterisk (*)
26       to make libcurl continue even  if  the  command  fails  as  by  default
27       libcurl will stop at first failure.
28
29       The  set  of valid FTP commands depends on the server (see RFC959 for a
30       list of mandatory commands).
31
32       libcurl does not inspect, parse or "understand" the commands passed  to
33       the  server  using this option. If you change connection state, working
34       directory or similar using quote commands, libcurl will not know  about
35       it.
36
37       The valid SFTP commands are:
38
39              atime date file
40                     The  atime  command sets the last access time of the file
41                     named by the file operand. The <date expression>  can  be
42                     all  sorts  of  date strings, see the curl_getdate(3) man
43                     page for date expression details. (Added in 7.73.0)
44
45              chgrp group file
46                     The chgrp command sets the group ID of the file named  by
47                     the  file  operand to the group ID specified by the group
48                     operand. The group operand is a decimal integer group ID.
49
50              chmod mode file
51                     The chmod command modifies the  file  mode  bits  of  the
52                     specified file. The mode operand is an octal integer mode
53                     number.
54
55              chown user file
56                     The chown command sets the owner of the file named by the
57                     file  operand  to the user ID specified by the user oper‐
58                     and. The user operand is a decimal integer user ID.
59
60              ln source_file target_file
61                     The ln and symlink commands create a symbolic link at the
62                     target_file  location  pointing  to the source_file loca‐
63                     tion.
64
65              mkdir directory_name
66                     The mkdir command creates the directory named by the  di‐
67                     rectory_name operand.
68
69              mtime date file
70                     The  mtime command sets the last modification time of the
71                     file named by the file operand. The <date expression> can
72                     be all sorts of date strings, see the curl_getdate(3) man
73                     page for date expression details. (Added in 7.73.0)
74
75              pwd    The pwd command returns the absolute pathname of the cur‐
76                     rent working directory.
77
78              rename source target
79                     The rename command renames the file or directory named by
80                     the source operand to the destination path named  by  the
81                     target operand.
82
83              rm file
84                     The rm command removes the file specified by the file op‐
85                     erand.
86
87              rmdir directory
88                     The rmdir command removes the directory  entry  specified
89                     by the directory operand, provided it is empty.
90
91              statvfs file
92                     The statvfs command returns statistics on the file system
93                     in which specified file resides. (Added in 7.49.0)
94
95              symlink source_file target_file
96                     See ln.
97

DEFAULT

99       NULL
100

PROTOCOLS

102       SFTP and FTP
103

EXAMPLE

105       struct curl_slist *cmdlist = NULL;
106       cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
107       cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
108
109       curl = curl_easy_init();
110       if(curl) {
111         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
112
113         /* pass in the FTP commands to run before the transfer */
114         curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist);
115
116         ret = curl_easy_perform(curl);
117
118         curl_easy_cleanup(curl);
119       }
120

AVAILABILITY

122       SFTP support added in 7.16.3. *-prefix for SFTP added in 7.24.0
123

RETURN VALUE

125       Returns CURLE_OK
126

SEE ALSO

128       CURLOPT_POSTQUOTE(3), CURLOPT_PREQUOTE(3),
129
130
131
132libcurl 7.85.0                   May 17, 2022                 CURLOPT_QUOTE(3)
Impressum