Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1383487
  • 博文数量: 247
  • 博客积分: 10147
  • 博客等级: 上将
  • 技术积分: 2776
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-24 15:18
文章分类

全部博文(247)

文章存档

2013年(11)

2012年(3)

2011年(20)

2010年(35)

2009年(91)

2008年(87)

我的朋友

分类: LINUX

2011-02-06 12:35:25

wget使用技巧
2010-01-11 11:33

OPTIONS  
       Option Syntax

       Since Wget uses GNU getopt to process command-line arguments, every option has a long form along with the short
       one. Long options are more convenient to remember, but take time to type. You may freely mix different option
       styles, or specify options after the command-line arguments. Thus you may write:

               wget -r --tries=10 -o log

       The space between the option accepting an argument and the argument may be omitted. Instead -o log you can write
       -olog.

       You may put several options that do not require arguments together, like:

               wget -drc

       This is a complete equivalent of:

               wget -d -r -c

       Since the options can be specified after the arguments, you may terminate them with --. So the following will try
       to download URL -x, reporting failure to log:

               wget -o log -- -x

       The options that accept comma-separated lists all respect the convention that specifying an empty list clears its
       value. This can be useful to clear the .wgetrc settings. For instance, if your .wgetrc sets "exclude_directories"
       to /cgi-bin, the following example will first reset it, and then set it to exclude /~nobody and /~somebody. You
       can also clear the lists in .wgetrc.

               wget -X ’’ -X /~nobody,/~somebody

       Most options that do not accept arguments are boolean options, so named because their state can be captured with a
       yes-or-no (‘‘boolean’’) variable. For example, --follow-ftp tells Wget to follow FTP links from HTML files and, on
       the other hand, --no-glob tells it not to perform file globbing on FTP URLs. A boolean option is either affirma-
       tive or negative (beginning with --no). All such options share several properties.

       Unless stated otherwise, it is assumed that the default behavior is the opposite of what the option accomplishes.
       For example, the documented existence of --follow-ftp assumes that the default is to not follow FTP links from HTML
       pages.

       Affirmative options can be negated by prepending the --no- to the option name; negative options can be negated by
       omitting the --no- prefix. This might seem superfluous---if the default for an affirmative option is to not do
       something, then why provide a way to explicitly turn it off? But the startup file may in fact change the default.
       For instance, using "follow_ftp = off" in .wgetrc makes Wget not follow FTP links by default, and using --no-fol-
       low-ftp is the only way to restore the factory default from the command line.

Chinese Explanation

# wget -r -np -nd
下载 网站上 packages 目录中的所有文件。其中,-np 的作用是不遍历父目录,-nd 表示不在本机重新创建目录结构。
# wget -r -np -nd --accept=iso /centos-5/i386/
与上一条命令相似,但多加了一个 --accept=iso 选项,这指示 wget 仅下载 i386 目录中所有扩展名为 iso 的文件。你也可以指定多个扩展名,只需用逗号分隔即可。
#wget -i filename.txt
此命令常用于批量下载的情形,把所有需要下载文件的地址放到 filename.txt 中,然后 wget 就会自动为你下载所有文件了。
#wget -c /really-big-file.iso
这里所指定的 -c 选项的作用为断点续传。
#wget -m -k (-H)
该命令可用来镜像一个网站,wget 将对链接进行转换。如果网站中的图像是放在另外的站点,那么可以使用 -H 选项。


阅读(1058) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2011-03-06 17:50:11

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com