CURL命令行工具-从FTP服务器删除文件

标签 curl command-line ftp delete-file

我实际上正在尝试使用CURL在带有Visual Studio的C++中的ftp服务器上进行一些操作。我可以很轻松地使用命令行工具进行一些上载或下载。

但是对于删除某些文件,我有一些错误。

这是我键入的命令:

curl -v -u username:pwd ftp://host/FileTodelete.xml -Q '-DELE FileTodelete.xml'

这是答案:
* Adding handle: conn: 0x1ca5260
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1ca5260) send_pipe: 1, recv_pipe: 0
* About to connect() to host port 21 (
*   Trying ......
* Connected to host (...) po
< 220-FileZilla Server version 0.9.49 beta
< 220 Bienvenue sur le serveur FTP de HandTrainer
> USER username
< 331 Password required for username
> PASS pwd
< 230 Logged on
> PWD
< 257 "/" is current directory.
* Entry path is '/'
> '-DELE
* ftp_perform ends with SECONDARY: 0
< 500 Syntax error, command unrecognized.
* QUOT command failed with 500
* Closing connection 0
curl: (21) QUOT command failed with 500
* Rebuilt URL to: FileTodelete.xml'/
* Adding handle: conn: 0x1ca5260
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 1 (0x1ca5260) send_pipe: 1, recv_pipe: 0
* Could not resolve host: FileTodelete.xml'
* Closing connection 1
curl: (6) Could not resolve host: FileTodelete.xml'

而且,该文件在服务器上,所以我听不懂。

最佳答案

问题解决了! DELE之前的破折号不应存在:

curl -v -u username:pwd ftp://host/FileTodelete.xml -Q "DELE FileTodelete.xml"

关于CURL命令行工具-从FTP服务器删除文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28721515/

相关文章:

command-line - 从环境变量中去除回车符 - XP 命令行

http - curl + jsecurity认证

powershell - 调用 WebRequest : Cannot bind parameter 'Headers'

windows - 如何让 cURL 从 Windows 命令行运行?

java - 初学者 Java(循环)- 自动售货机

Linux FTP : Operation now in progress after restart/put

linux - iptables 的 FTP 问题

java - 如何使用 PHP 到 Java 的 JSON 数据发出 POST 请求?

python - 使用 Python 从 linux 命令行读取

Azure FTP 问题 - 无法上传文件