Art*_*rdi 8 ftp command-line curl delete-file
我实际上是想CURL
用Visual Studio在C++的ftp服务器上进行一些操作.使用commande line工具进行一些上传或下载都没有问题.
但是为了删除一些文件我有一些错误.
这是我键入的命令:
curl -v -u username:pwd ftp://host/FileTodelete.xml -Q '-DELE FileTodelete.xml'
Run Code Online (Sandbox Code Playgroud)
这就是答案:
* 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'
Run Code Online (Sandbox Code Playgroud)
而且,文件在服务器上,所以我不明白.
Art*_*rdi 14
问题解决了 !
似乎单引号不起作用:
curl -v -u username:pwd ftp://host/FileTodelete.xml -Q "DELE FileTodelete.xml"
Run Code Online (Sandbox Code Playgroud)
您使用放置命令-Q
,但-DELE file
不是常用的ftp命令。请尝试以下方法之一:
curl -v -u username:pwd ftp://host/FileTodelete.xml -Q 'DELE FileTodelete.xml'
curl -v -u username:pwd ftp://host/FileTodelete.xml -Q 'DELETE FileTodelete.xml'
curl -v -u username:pwd ftp://host/FileTodelete.xml -Q 'rm FileTodelete.xml'
Run Code Online (Sandbox Code Playgroud)