2012年7月31日星期二

使用命令行从FTP上下载整个目录


wget -m ftp://xxxx/dirname -- ftp-user=user --ftp-password=password
m 参数表示镜像指定的目录 等同于  -r -N -l inf --no-remove-listing
能实现此功能的另一个办法是
wget -rtxx ftp://172.16.12.111/ppp/* 
r是断点绪传,t是失败后可重新联接的xx次。
例如从ftp上直接下载整个目录到本地,我使用的完整命令是
wget  -nH --cut-dirs=1 -m --ftp-user=szh --ftp-password=szhftp ftp://192.168.13.17/Server_CDROM

从ftp下载时与目标路径相关的两个参数:
-nH
       --no-host-directories
           Disable generation of host-prefixed directories.  By default, invoking Wget with -r
           http://fly.srk.fer.hr/ will create a structure of directories beginning with
           fly.srk.fer.hr/.  This option disables such behavior.
--cut-dirs=number
           Ignore number directory components.  This is useful for getting a fine-grained control
           over the directory where recursive retrieval will be saved.

没有评论:

发表评论