我试图下载一个很大的 iso(6,822,254,592 字节)。下载了 4,423,760,272 字节(超过 4GB,因此这不是简单的 4GB 限制问题)后,我的网络连接中断了很长时间,导致 wget 无法自动重启,因此我尝试继续。但是,尽管 wget 认为它下载了文件的剩余部分,但实际上它并没有更改文件。
HTTP request sent, awaiting response... 206 Partial Content
Length: 6,822,254,592 (6.4G), 2,398,494,320 (2.2G) remaining [application/octet-stream]
100%[++++++++++++++++++++++============>] 6,822,254,592 205.39K/s ETA 00:00
18:13:09 (191.53 KB/s) - `InstallDVD.iso' saved [6822254592/6822254592]
Q:\>dir
Volume in drive Q is New Volume
Volume Serial Number is F273-5A8A
Directory of Q:\
14/01/2011 22:23 4,423,760,272 InstallDVD.iso
1 File(s) 4,423,760,272 bytes
我正在使用 wget 1.10.2,以防这个版本已知有缺陷。
编辑:s/resume/continue/g 因为不清楚我的意思。
答案1
wget 有一个功能,支持从上次停止的地方继续下载。wget 手册页(来自 NetBSD)的以下部分解释了“-c”和“--continue”开关:
-c
--continue
Continue getting a partially-downloaded file. This is useful when
you want to finish up a download started by a previous instance of
Wget, or by another program. For instance:
wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z
If there is a file named ls-lR.Z in the current directory, Wget
will assume that it is the first portion of the remote file, and
will ask the server to continue the retrieval from an offset equal
to the length of the local file.
...
默认情况下,wget 会尝试从头开始下载文件,而不是继续。但这是一件好事,因为如果已经存在同名的较小文件,则其内容将附加无关数据,这可能会导致意外问题。