使用cUrl从ftp中删除文件

使用cUrl从ftp中删除文件,curl,ftp,Curl,Ftp,我试图在命令行中从ftp服务器中删除一个文件。看起来是这样的: curl -v -O ftp://192.168.26.10/inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm -Q 'DELE inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm' 文件被删除了,但输出看起来很奇怪,据我所知,curl返回了一个错误。因此,输出: < 220 NASF

我试图在命令行中从ftp服务器中删除一个文件。看起来是这样的:

curl -v -O ftp://192.168.26.10/inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm -Q 'DELE inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm'
文件被删除了,但输出看起来很奇怪,据我所知,curl返回了一个错误。因此,输出:

< 220 NASFTPD Turbo station 1.3.5a Server (ProFTPD)
> USER anonymous
< 331 Anonymous login ok, send your complete email address as your password
> PASS ftp@example.com
< 230 Anonymous access granted, restrictions apply
> PWD
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0< 257 "/" is the current directory
* Entry path is '/'
> DELE inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm
* ftp_perform ends with SECONDARY: 0
< 250 DELE command successful
> CWD inbox
< 250 CWD command successful
> CWD project
< 250 CWD command successful
> CWD logs
< 250 CWD command successful
> CWD video
< 250 CWD command successful
> EPSV
* Connect data stream passively
< 229 Entering Extended Passive Mode (|||55808|)
* Hostname was NOT found in DNS cache
*   Trying 192.168.26.10...
* Connecting to 192.168.26.10 (192.168.26.10) port 55808
* Connected to 192.168.26.10 (192.168.26.10) port 21 (#0)
> TYPE I
< 200 Type set to I
> SIZE super_user_2017-09-25_19-20-27.webm
< 550 super_user_2017-09-25_19-20-27.webm: No such file or directory
> RETR super_user_2017-09-25_19-20-27.webm
< 550 super_user_2017-09-25_19-20-27.webm: No such file or directory
* RETR response: 550
* Remembering we are in dir "inbox/project/logs/video/"
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host 192.168.26.10 left intact
curl: (78) RETR response: 550
<220 NASFTPD涡轮电站1.3.5a服务器(ProFTPD)
>匿名用户
<331匿名登录确定,发送完整的电子邮件地址作为密码
>通过ftp@example.com
<230已授予匿名访问,限制适用
>PWD
0 0 0 0 0 0 0--::-->::-->:--:------0<257“/”是当前目录
*输入路径为“/”
>DELE收件箱/项目/日志/视频/超级用户\u 2017-09-25\u 19-20-27.webm
*ftp_执行结束与辅助:0
<250 DELE命令成功
>CWD收件箱
<250 CWD命令成功
>CWD项目
<250 CWD命令成功
>CWD日志
<250 CWD命令成功
>CWD视频
<250 CWD命令成功
>EPSV
*被动连接数据流
<229进入扩展被动模式(| | | 55808 |)
*在DNS缓存中找不到主机名
*正在尝试192.168.26.10。。。
*连接到192.168.26.10(192.168.26.10)端口55808
*连接到192.168.26.10(192.168.26.10)端口21(0)
>第一类
<200类型设置为I
>超级用户尺寸2017-09-25-19-20-27.webm
<550 super_user_2017-09-25_19-20-27.webm:没有这样的文件或目录
>RETR super_user_2017-09-25_19-20-27.webm
<550 super_user_2017-09-25_19-20-27.webm:没有这样的文件或目录
*回复:550
*记住我们在目录“收件箱/项目/日志/视频”
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
*0到主机192.168.26.10的连接保持不变
旋度:(78)回复:550

我的命令怎么了?太多了

我明白问题所在,所以我将尝试回答我自己的问题。我稍微改变了一下命令。所以现在看起来像这样

curl -v  ftp://192.168.26.10/inbox/project/logs/video  -Q"DELE /inbox/project/logs/video/super_user_2017-09-25_19-20-27.webm"
/收件箱/项目/日志/视频/超级用户2017-09-25\u 19-20-27.webm

是要删除的文件的完整路径

是包含该文件的目录。删除文件后,curl在远程服务器上运行LIST命令以显示文件已成功删除。就像午夜指挥官删除文件一样。您删除该文件,它会自动为您刷新目录。我的错误是我使用的不是目录而是文件本身

因此,删除curl后,将检查文件是否已成功删除,并在ftp服务器上运行RETR。并获取尝试检索此文件时出错,因为该文件不存在