CURL 命令行工具 - 从 FTP 服务器删除文件 [英] CURL command line tool - Delete File from FTP server

查看:54
本文介绍了CURL 命令行工具 - 从 FTP 服务器删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实际上是在尝试使用 CURL 通过 Visual Studio 在 C++ 中的 ftp 服务器上进行一些操作.我可以使用命令行工具进行一些上传或下载.

I'm actually trying to use CURL to make some operations on a ftp server in C++ with Visual Studio. I've no trouble to do some uploads or downloads with commande line tools.

但是对于删除一些文件我有一些错误.

But for deleting some file I have some errors.

这是我输入的命令:

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'

另外,文件在服务器上,所以没看懂.

Moreover, the file is on the server so I don't understand.

推荐答案

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

Problem solved! The dash before DELE should not be there:

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

这篇关于CURL 命令行工具 - 从 FTP 服务器删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆