CURLOPT_QUOTE.3 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. .\" generated by cd2nroff 0.1 from CURLOPT_QUOTE.md
  2. .TH CURLOPT_QUOTE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_QUOTE \- (S)FTP commands to run before transfer
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_QUOTE,
  9. struct curl_slist *cmds);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a linked list of FTP or SFTP commands to pass to the server
  13. prior to your request. This is done before any other commands are issued (even
  14. before the CWD command for FTP). The linked list should be a fully valid list
  15. of \(aqstruct curl_slist\(aq structs properly filled in with text strings. Use
  16. \fIcurl_slist_append(3)\fP to append strings (commands) to the list, and clear
  17. the entire list afterwards with \fIcurl_slist_free_all(3)\fP.
  18. Disable this operation again by setting a NULL to this option.
  19. When speaking to an FTP server, prefix the command with an asterisk (*) to
  20. make libcurl continue even if the command fails as by default libcurl stops at
  21. first failure.
  22. The set of valid FTP commands depends on the server (see RFC 959 for a list of
  23. mandatory commands).
  24. libcurl does not inspect, parse or "understand" the commands passed to the
  25. server using this option. If you change connection state, working directory or
  26. similar using quote commands, libcurl does not know about it.
  27. The path arguments for FTP or SFTP can use single or double quotes to
  28. distinguish a space from being the parameter separator or being a part of the
  29. path. e.g. rename with sftp using a quote command like this:
  30. .nf
  31. "rename 'test/_upload.txt' 'test/Hello World.txt'"
  32. .fi
  33. .SH SFTP commands
  34. .IP "atime date file"
  35. The atime command sets the last access time of the file named by the file
  36. operand. The date expression can be all sorts of date strings, see the
  37. \fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0)
  38. .IP "chgrp group file"
  39. The chgrp command sets the group ID of the file named by the file operand to
  40. the group ID specified by the group operand. The group operand is a decimal
  41. integer group ID.
  42. .IP "chmod mode file"
  43. The chmod command modifies the file mode bits of the specified file. The
  44. mode operand is an octal integer mode number.
  45. .IP "chown user file"
  46. The chown command sets the owner of the file named by the file operand to the
  47. user ID specified by the user operand. The user operand is a decimal
  48. integer user ID.
  49. .IP "ln source_file target_file"
  50. The \fBln\fP and \fBsymlink\fP commands create a symbolic link at the
  51. target_file location pointing to the source_file location.
  52. .IP "mkdir directory_name"
  53. The mkdir command creates the directory named by the directory_name operand.
  54. .IP "mtime date file"
  55. The mtime command sets the last modification time of the file named by the
  56. file operand. The date expression can be all sorts of date strings, see the
  57. \fIcurl_getdate(3)\fP man page for date expression details. (Added in 7.73.0)
  58. .IP pwd
  59. The \fBpwd\fP command returns the absolute path of the current working
  60. directory.
  61. .IP "rename source target"
  62. The rename command renames the file or directory named by the source
  63. operand to the destination path named by the target operand.
  64. .IP "rm file"
  65. The rm command removes the file specified by the file operand.
  66. .IP "rmdir directory"
  67. The rmdir command removes the directory entry specified by the directory
  68. operand, provided it is empty.
  69. .IP "statvfs file"
  70. The statvfs command returns statistics on the file system in which specified
  71. file resides. (Added in 7.49.0)
  72. .IP "symlink source_file target_file"
  73. See ln.
  74. .SH DEFAULT
  75. NULL
  76. .SH PROTOCOLS
  77. This functionality affects ftp and sftp
  78. .SH EXAMPLE
  79. .nf
  80. int main(void)
  81. {
  82. struct curl_slist *cmdlist = NULL;
  83. cmdlist = curl_slist_append(cmdlist, "RNFR source-name");
  84. cmdlist = curl_slist_append(cmdlist, "RNTO new-name");
  85. CURL *curl = curl_easy_init();
  86. if(curl) {
  87. CURLcode res;
  88. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
  89. /* pass in the FTP commands to run before the transfer */
  90. curl_easy_setopt(curl, CURLOPT_QUOTE, cmdlist);
  91. res = curl_easy_perform(curl);
  92. curl_easy_cleanup(curl);
  93. }
  94. }
  95. .fi
  96. .SH HISTORY
  97. SFTP support added in 7.16.3. *\-prefix for SFTP added in 7.24.0
  98. .SH AVAILABILITY
  99. Added in curl 7.1
  100. .SH RETURN VALUE
  101. Returns CURLE_OK
  102. .SH SEE ALSO
  103. .BR CURLOPT_CUSTOMREQUEST (3),
  104. .BR CURLOPT_DIRLISTONLY (3),
  105. .BR CURLOPT_POSTQUOTE (3),
  106. .BR CURLOPT_PREQUOTE (3)