|
Wget is developed under Linux open source software, the author is Hrvoje Niksic, was later ported to various platforms including Windows. It has the following functions and features:
(1) Support breakpoint transmission function; it is network FlashGet ants and the year's biggest selling point, now, Wget can also use this function, those network is not very good user can rest assured;
(2) supports both FTP and HTTP download method; although now most of the software you can use HTTP to download, but in some cases, still need to use FTP to download the software;
(3) support proxy server; For high security strength of the system, your system will generally not directly exposed to the Internet, so that the agent is to download the software must support some features;
(4) Easy setup and simple; possible, users accustomed to the graphical interface is not too accustomed to the command line, but, in fact, the command line has more advantages on the setting, at least, the mouse can be many times less, and do not worry about whether or not wrong mouse;
(5) a small program, completely free; small program can be considered not count, because the hard disk is too great; completely free of charge would have to consider, even if there are many so-called free software on the web, but the software is not advertising we like;
wget although powerful, but it is quite simple to use, the basic syntax is: wget [parameter list] URL. Here in connection with specific examples to illustrate the wget usage.
1, download the entire http or ftp site.
wget http: //place.your.url/here
This command can be http: //place.your.url/here Home download. Use -x forces to establish exactly the same directory on the server, if you use -nd parameter, then all content will be added to the local server to download the current directory.
wget -r http: //place.your.url/here
This command will follow the recursive method, the download servers of all directories and files, in essence, is to download the entire site. This command must be used with caution, because the download time, all the addresses pointed to the same kind of download sites will be downloaded, so if this site refers to other sites, then the referenced website will be downloaded! For this reason, this parameter is not commonly used. You can use the -l number parameter to specify the download level. For example, download only two, then use the -l 2.
If you want to make a mirror site, you can use the -m parameter, for example: wget -m http: //place.your.url/here
Then wget will automatically determine the appropriate parameters to create mirror sites. At this time, wget will log on to the server, read the press provisions robots.txt robots.txt to perform.
2, HTTP.
When a file is particularly large or particularly slow network, it is often a file has not been downloaded, the connection has been cut off, then you need HTTP. wget of HTTP is automatic, just use the -c parameter, for example:
wget -c http: //the.url.of/incomplete/file
Use HTTP server requires support for HTTP. -t parameter indicates the number of retries, for example, need to retry 100 times, then write -t 100, if set to -t 0, it indicates an infinite retry until successful connection. -T Parameter indicates the timeout period, for example -T 120, wait 120 seconds showing the connections are not even out.
3, bulk download.
If you have multiple files to download, you can generate a file, the URL of each file writing a single line, for example, generate documents download.txt, then use the command: wget -i download.txt
This will put each URL download.txt which lists are downloaded. (If the column is a file to download the file, if the column is the website, download the home page)
4, selective download.
You can specify that only wget to download a class file, or do not download any files. E.g:
wget -m -reject = gif http://target.web.site/subdirectory
The download http://target.web.site/subdirectory, but ignored gif file. -accept = LIST acceptable file types, -reject = LIST refused to accept the file type.
5, password, and authentication.
wget can only deal with the use of username / password way to limit access to the site, you can use two parameters:
-http-user = USER set user HTTP
-http-passwd = PASS set the HTTP password
The need to do certificate certified sites, you can only use the other download tools, such as curl.
6, the use of a proxy server to download.
If the user's network need to go through a proxy server, you can make wget download files through a proxy server. At this point you need to create a .wgetrc file in the current user's directory. Files can set a proxy server:
http-proxy = 111.111.111.111:8080
ftp-proxy = 111.111.111.111:8080
Respectively, http and ftp proxy server proxy server. If the proxy server requires a password, use:
-proxy-user = USER set user agent
-proxy-passwd = PASS set the proxy password
These two parameters.
Parameter -proxy = on / off or shut down using the proxy.
wget There are many useful features, users need to dig.
appendix:
Format:
wget [parameter list] [target software, web URL]
-V, -version Display software version number and then exit;
-h, -help display help information software;
-e, -execute = COMMAND execute a ".wgetrc" command
-o, -output-file = FILE software will save the output to a file;
-a, -append-output = FILE output software information appended to the file;
-d, -debug display output information;
-q, -quiet Do not display output information;
-i, -input-file = FILE get URL from the file;
-t, -tries = NUMBER whether downloads (0 for infinite times)
-O -output-Document = FILE save the downloaded file as a different file name
-nc, -no-clobber do not overwrite existing files
-N, -timestamping Than just download new files locally
-T, -timeout = SECONDS set the timeout
-Y, -proxy = On / off Close Agent
-nd, -no-directories do not create directories
-x, -force-directories force a directory
-http-user = USER set user HTTP
-http-passwd = PASS set the HTTP password
-proxy-user = USER set user agent
-proxy-passwd = PASS set the proxy password
-r, -recursive download the entire Web site, directory (caution)
-l, -level = NUMBER download level
-A, -accept = LIST acceptable file types
-R, -reject = LIST refused to accept the file types
-D, -domains = LIST acceptable domain
-exclude-domains = LIST refusal domain
Download Related link -L, -relative
-follow-ftp FTP only download links
-H, -span-Hosts can be downloaded outside of the host
-I, -include-Directories = LIST allow directory
-X, -exclude-Directories = LIST refuse directory
Chinese document name will be encoded in ordinary circumstances, but -cut-dirs time for the normal,
wget -r -np -nH -cut-dirs = 3 ftp: // host / test /
Test .txt
wget -r -np -nH -nd ftp: // host / test /
% B4% FA% B8% D5.txt
wget "ftp: // host / test / *"
% B4% FA% B8% D5.txt
Due to unknown reasons, possibly to avoid the special file name, wget will automatically fetch the file name part with encode_string treated, so the patch is put encode_string treated as "% 3A" this kind of thing, with a reduction decode_string to ":" and apply it in some directory and file name, decode_string is wget built-in functions.
wget -t0 -c -nH -x -np -b -m -P / home / sunny / NOD32view / http://downloads1.kaspersky-labs.com/bases/ -o wget.log |
|
|
|