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

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

问题描述

我实际上试图使用 CURL 在Visual Studio中使用C ++在ftp服务器上进行一些操作。使用命令行工具进行一些上传或下载没有问题。



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



这里是我键入的命令:

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

这是答案:

  *添加句柄:conn:0x1ca5260 
*添加句柄:发送:0
*添加句柄:recv:0
* Curl_addHandleToPipeline:length:1
* - Conn 0(0x1ca5260)send_pipe:1,recv_pipe:0
*关于连接到主机端口21(
* Trying。 .....
*连接到主机(...)po
< 220-FileZilla服务器版本0.9.49 beta
< 220 Bienvenue sur le serveur FTP de HandTrainer
> USER用户名
< 331用户名所需的密码
> PASS pwd
< 230登录
> PWD
< 257 是当前目录
*输入路径是'/'
>'-DELE
* ftp_perform以SECONDARY结尾:0
< 500语法错误,命令无法识别。
* QUOT命令失败,500
*关闭连接0
curl:(21)QUOT命令失败,500
*重建URL到:FileTodelete.xml'/
*添加句柄:conn:0x1ca5260
*添加句柄:发送:0
*添加句柄:recv:0
* Curl_addHandleToPipeline:length:1
* - Conn 1(0x1ca5260) send_pipe:1,recv_pipe:0
*无法解析主机:FileTodelete.xml'
*关闭连接1
curl:(6)无法解析主机:FileTodelete.xml'

此外,该文件在服务器上,因此我不明白。



似乎简单的报价不工作,因此:

  curl -v -u用户名:pwd ftp://host/FileTodelete.xml -QDELE FileTodelete.xml


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.

Here is the command I type:

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

This is the answer:

* 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.

解决方案

Problem solved !

It seems that the simple quote didn"t work so :

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

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

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