码迷,mamicode.com
首页 > Web开发 > 详细

curl命令之ftp上传实例

时间:2015-02-28 18:49:53      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:http 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>

curl命令之ftp上传实例

标签:http ftp

原文地址:http://blog.csdn.net/hellochenlian/article/details/43987043

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!