使用-x选项通过curl删除文件

时间:2015-06-05 16:49:43

标签: curl ftp

更新:如果我通过桌面运行它,这是有效的,但似乎Q命令不能与squid代理一起使用。有没有人知道解决这个问题的方法?

curl -v -u user:pswd -Q" DELE test_file.txt" ftp://ftp.com

我已尝试使用此curl语句的各种版本从ftp服务器删除文件,但它只是继续尝试下载文件(而不是删除它)或错误输出(例如下面的例子)。根据我的阅读,由于-x参数,看起来这可能是不可能的?没有它我无法连接到FTP。我是从shell脚本运行它们的。

这个下载文件:

curl -x ${PROXY_HOST_PORT} -u ${FTP_USER_PSWD} ${FILE_PATH} -Q "DELE $FILE"

这一个错误:

curl -X DELETE -x ${PROXY_HOST_PORT} -u ${FTP_USER_PSWD} ${FILE_PATH}


<h1>ERROR</h1>
<h2>The requested URL could not be retrieved</h2>
</div>
<hr>

<div id="content">
<p>The following error was encountered while trying to retrieve the URL: <a href="ftp://ftpserver/folder/file">ftp://ftpserver/folder/file</a></p>

<blockquote id="error">
<p><b>Unsupported Request Method and Protocol</b></p>
</blockquote>

<p>Squid does not support all request methods for all access protocols. For example, you can not POST a Gopher request.</p>

0 个答案:

没有答案