CURLOPT_QUOTE.3 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_QUOTE 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_QUOTE \- (S)FTP commands to run before transfer
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUOTE,
  32. struct curl_slist *cmds);
  33. .fi
  34. .SH DESCRIPTION
  35. Pass a pointer to a linked list of FTP or SFTP commands to pass to the server
  36. prior to your request. This will be done before any other commands are issued
  37. (even before the CWD command for FTP). The linked list should be a fully valid
  38. list of 'struct curl_slist' structs properly filled in with text strings. Use
  39. \fIcurl_slist_append(3)\fP to append strings (commands) to the list, and clear
  40. the entire list afterwards with \fIcurl_slist_free_all(3)\fP.
  41. Disable this operation again by setting a NULL to this option.
  42. When speaking to an FTP server, prefix the command with an asterisk (*) to
  43. make libcurl continue even if the command fails as by default libcurl will
  44. stop at first failure.
  45. The set of valid FTP commands depends on the server (see RFC 959 for a list of
  46. mandatory commands).
  47. libcurl does not inspect, parse or "understand" the commands passed to the
  48. server using this option. If you change connection state, working directory or
  49. similar using quote commands, libcurl will not know about it.
  50. The valid SFTP commands are:
  51. .RS
  52. .IP "atime date file"
  53. The atime command sets the last access time of the file named by the file
  54. operand. The <date expression> can be all sorts of date strings, see the
  55. \fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0)
  56. .IP "chgrp group file"
  57. The chgrp command sets the group ID of the file named by the file operand to
  58. the group ID specified by the group operand. The group operand is a decimal
  59. integer group ID.
  60. .IP "chmod mode file"
  61. The chmod command modifies the file mode bits of the specified file. The
  62. mode operand is an octal integer mode number.
  63. .IP "chown user file"
  64. The chown command sets the owner of the file named by the file operand to the
  65. user ID specified by the user operand. The user operand is a decimal
  66. integer user ID.
  67. .IP "ln source_file target_file"
  68. The \fBln\fP and \fBsymlink\fP commands create a symbolic link at the
  69. target_file location pointing to the source_file location.
  70. .IP "mkdir directory_name"
  71. The mkdir command creates the directory named by the directory_name operand.
  72. .IP "mtime date file"
  73. The mtime command sets the last modification time of the file named by the
  74. file operand. The <date expression> can be all sorts of date strings, see the
  75. \fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0)
  76. .IP "pwd"
  77. The \fBpwd\fP command returns the absolute path of the current working
  78. directory.
  79. .IP "rename source target"
  80. The rename command renames the file or directory named by the source
  81. operand to the destination path named by the target operand.
  82. .IP "rm file"
  83. The rm command removes the file specified by the file operand.
  84. .IP "rmdir directory"
  85. The rmdir command removes the directory entry specified by the directory
  86. operand, provided it is empty.
  87. .IP "statvfs file"
  88. The statvfs command returns statistics on the file system in which specified
  89. file resides. (Added in 7.49.0)
  90. .IP "symlink source_file target_file"
  91. See ln.
  92. .RE
  93. .SH DEFAULT
  94. NULL
  95. .SH PROTOCOLS
  96. SFTP and FTP
  97. .SH EXAMPLE
  98. .nf
  99. struct curl_slist *cmdlist = NULL;
  100. cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
  101. cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
  102. curl = curl_easy_init();
  103. if(curl) {
  104. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
  105. /* pass in the FTP commands to run before the transfer */
  106. curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist);
  107. ret = curl_easy_perform(curl);
  108. curl_easy_cleanup(curl);
  109. }
  110. .fi
  111. .SH AVAILABILITY
  112. SFTP support added in 7.16.3. *-prefix for SFTP added in 7.24.0
  113. .SH RETURN VALUE
  114. Returns CURLE_OK
  115. .SH "SEE ALSO"
  116. .BR CURLOPT_POSTQUOTE "(3), " CURLOPT_PREQUOTE "(3), "