curl命令之ftp上传实例

The simplest way to access a ftp server with username and password




curl ftp://myftpsite.com --user myname:mypassword&nbsp;</span>




With the command line above, curl will try to connect to the ftp server and list all the directories and files in the ftp home directory.
To download a file from ftp server




curl ftp://myftpsite.com/mp3/mozart_piano_sonata.zip --user myname:mypassword -o mozart_piano_sonata.zip</span>




To upload a file to ftp server




curl -T koc_dance.mp3 ftp://myftpsite.com/mp3/ --user myname:mypassword</span>




To list files in sub directories.




curl ftp://myftpsite.com/mp3/ &nbsp;--user myname:mypassword</span>




List only directories, silent the curl progress bar, and use grep to filter




curl ftp://myftpsite.com &nbsp;--user myname:mypassword -s | grep ^d</span>




Remove files from ftp server.
This is a bit tricky, because curl do not support that by default, well anyway, you can make use of -X and pass in the REAL FTP command.
(Check out a list of FTP service Command in rfc 959, under 4.1.3. FTP SERVICE COMMANDS)




curl ftp://myftpsite.com/ -X 'DELE mp3/koc_dance.mp3' --user myname:mypassword</span>




Caution: Make sure you are know what are you deleting! It will not prompts ‘Are you sure?’ confirmation.
Check out curl manual for more,




man curl</span>




or this, ^^ (contains different info)




curl --manual | less&nbsp;</span>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

北京橙溪科技有限公司enwing.com

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值