wget使用文档:https://www.gnu.org/software/wget/manual/wget.html

最开始常用的比如:

wget -O  /e/movie.mp4 http://www.com/m.mp4
输出到e盘的movie.mp4文件:可是 - O 默认会覆盖文件!
所以在最后面加个 -c  表示继续下载。wget -O  /e/movie.mp4 -c

wget -P /e/ http://www.com/m.mp4
下载到e盘,文件名保持和url上的一样(m.mp4):
-P 表示下载目录(prefix)

---

翻译了一下文档 wget 1.12的 -c 选项的使用方法。

-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 未完成的下载,别的程序未完成的也可以,比如:

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.

在当前目录已经有一个lS-IR.Z这个文件的话,它将会被wget当成远程文件的前一部分文件,然后会要求服务器从本地文件大小的位置开始续传。

Note that you don't need to specify this option if you just want the current invocation of Wget to retry downloading a file should the connection be lost midway through. This is the default behavior. -c only affects resumption of downloads started prior to this invocation of Wget, and whose local files are still sitting around.

注意,如果你只是想要在当前调用的wget中途断掉连接后,重试下载文件时续传,你没必要去指定这个选项。它会在重试的时候默认继续下载。-c 只会作用在最开始调用wget,而本地文件已经存在了的时候。

Without -c, the previous example would just download the remote file to ls-lR.Z.1, leaving the truncated ls-lR.Z file alone.

下载的时候不带-c, 之前的例子就会下载远程文件到ls-LS.Z.1,不会影响未下载完全的ls-LS.Z。

Beginning with Wget 1.7, if you use -c on a non-empty file, and it turns out that the server does not support continued downloading, Wget will refuse to start the download from scratch, which would effectively ruin existing contents. If you really want the download to start from scratch, remove the file.

从1.7版开始,如果你使用 -c 在一个不为空的文件上,恰巧服务器又不支持断点续传。wget会拒绝把抓到内容(scratch?)下载到文件,因为再继续下载的话会毁掉已经存在的文件。所以,只有移除文件,然后从头开始下载。

Also beginning with Wget 1.7, if you use -c on a file which is of equal size as the one on the server, Wget will refuse to download the file and print an explanatory message. The same happens when the file is smaller on the server than locally (presumably because it was changed on the server since your last download attempt)---because ``continuing'' is not meaningful, no download occurs.

同样是从1.7 版开始,如果你使用 -c 继续下载一个文件,恰好这个文件的大小和服务器上的一样大,wget会拒绝下载这个文件,然后命令行输出解释信息。同样的,如果服务器上的比本地文件还要小的话(也许自从上次你下载了之后更改过了),继续下载也没有意义了,也不会下载。

On the other side of the coin, while using -c, any file that's bigger on the server than locally will be considered an incomplete download and only "(length(remote) - length(local))" bytes will be downloaded and tacked onto the end of the local file. This behavior can be desirable in certain cases---for instance, you can use wget -c to download just the new portion that's been appended to a data collection or log file.

另一方面,当使用 -c 的时候,服务器的文件比本地文件大的时候都会被认为未完成的下载,只会下载 远程文件长度 减去 本地文件长度 的字节数内容,然后添加到本地文件的后面。 这个方式在大多数情况下是不错的 —— 比如,你可以使用wget -c 只下载数据收集或者日志文件新增的部分。

However, if the file is bigger on the server because it's been changed, as opposed to just appended to, you'll end up with a garbled file. Wget has no way of verifying that the local file is really a valid prefix of the remote file. You need to be especially careful of this when using -c in conjunction with -r, since every file will be considered as an ``incomplete download'' candidate.

然而,如果服务器上的文件比较大,是因为他更改过了,而不是在后面增加了,你将会得到一个没有用的文件。wget是无法验证本地的文件是否是远程文件的前一部分的。当你在和 -r 一起使用的时候,千万小心,因为每个文件都被认为是一个没有完成的下载。

Another instance where you'll get a garbled file if you try to use -c is if you have a lame HTTP proxy that inserts a ``transfer interrupted'' string into the local file. In the future a ``rollback'' option may be added to deal with this case.

另外一种情况,你用 -c 也会得到一个没用的文件:如果你使用不稳定的http代理,将会插入一个“传输中断”的字符串到你的本地文件,在之后的版本会添加“rollback” 选项,以处理这种情况。

Note that -c only works with FTP servers and with HTTP servers that support the "Range" header.

注意 -c 只会在支持“range” 头的ftp服务器和http服务器上使用。

用wget下载文件的更多相关文章

  1. 多线程爬虫Java调用wget下载文件,独立线程读取输出缓冲区

    写了个抓取appstore的,要抓取大量的app,本来是用httpclient,但是效果不理想,于是直接调用wget下载,但是由于标准输出.错误输出的原因会导致卡住,另外wget也会莫名的卡住. 所以 ...

  2. linux上使用wget下载文件

    首次安装的centos操作系统是没有安装wget的,所以首先需要先安装wget,然后才能使用wget下载文件. 1.第一步,保证centos能正常连网.使用命令  :yum -y install wg ...

  3. CentOS7.5 通过wget下载文件到指定目录

    在Linux命令行下面下载文件,通过wget是比较普遍简单的,比如在CentOS7 里面也一样. 我们先来看下自己的CentOS7 系统有没有安装wget: [root@test redis]# rp ...

  4. wget下载文件

    http://blog.sina.com.cn/s/blog_4af3f0d20100n1k0.html 一.下载目录 #wget -r -np -nd http://example.com/pack ...

  5. CentOS7通过wget下载文件到指定目录

    查看自己的CentOS7系统有没有安装wget: [duanyongchun@192 3DUnetCNN]$ rpm -qa|grep wget 已安装提示: #已安装提示:wget-1.14-18. ...

  6. 利用WGET下载文件,并保存到指定目录

    wget是Linux上一个非常不错的下载指令,也算是Linux工作者常用的指令之一 而这个指令我想在各大系统都预设有提供,包括了Ubuntu.Fedora等,而一般来说,要使用wget下载档案,只需要 ...

  7. wget 下载文件重进行命名

    wget在下载的时候就重命名的: wget -c "www.baidu.com" -O baidu.index.html 保存输出日至,可以使用: wget -c "ww ...

  8. wget 下载文件

    # -c 继续执行上次终端的任务# --http-user http用户名# --http-passwd http密码# --no-check-certificate 不检查ssl/tsl证书. wg ...

  9. wget下载FTP的文件

    在Linux中我们怎么样实现wget来下载文件  下面例子 下载所有的py结尾的文件到当前目录 wget ftp://anymous:anymous@42.51.152.2/soft/*.py 递归的 ...

随机推荐

  1. MFC 颜色选择对话框、颜色按钮

    COLORREF color=RGB(0,255,0); unsigned char r=GetRValue(color); unsigned char g=GetGValue(color); uns ...

  2. 转圈游戏(codevs 3285)

    题目描述 Description n 个小伙伴(编号从 0 到 n-1)围坐一圈玩游戏.按照顺时针方向给 n 个位置编号,从0 到 n-1.最初,第 0 号小伙伴在第 0 号位置,第 1 号小伙伴在第 ...

  3. 学习BigDecimal用法

    一.简介 Java在java.math包中提供的API类BigDecimal,用来对超过16位有效位的数进行精确的运算.双精度浮点型变量double可以处理16位有效数.在实际应用中,需要对更大或者更 ...

  4. Instruments_Activity Monitor使用入门

    Activity Monitor,官方解释为:(活动监视器)即实时显示CPU.内存和网络的使用情况,记录由虚拟内存大小测量的系统负载.用一句大白话来说,Activity Monitor类似Window ...

  5. /bin/dd if=/path/to/source-file of=/path/to/backup-file

    [root@ok virhost]# qemu-img info 05t.img image: 05t.img file format: raw virtual size: 10G (10737418 ...

  6. 思考探索,如何才能高效访问我的这个DataTable?

    需求 一切都是空的,除了Money,只有需求才是最真的,你懂的. 最近接到个略显棘手的需求,思索再三,想出两种方法,可觉得都不太好,这里与大家讨论一下. 需求如下: 用户需要在现有的某个grid中添加 ...

  7. HDU 5682/BestCoder Round #83 1003 zxa and leaf 二分+树

    zxa and leaf Problem Description zxa have an unrooted tree with n nodes, including (n−1) undirected ...

  8. 在crontab中动态写日志

    45 3 * * * setsid script -c /home/dlht/shell/coreBusiness/coreOpt.sh  >> /home/dlht/logs/coreO ...

  9. 解决修改重命名sql Server数据库名称

    错误: 消息 5030,级别 16,状态 2,第 1 行无法用排他锁锁定该数据库,以执行该操作. 解决方法:(原理一样) 1.将数据库设置为单用户模式 (单用户模式指定一次只有一个用户可访问数据库,该 ...

  10. javascript优化--07模式(对象)02

    沙箱模式: 解决空间命名模式的几个缺点: 命名空间模式中无法同时使用一个应用程序或库的两个版本运行在同一个页面中,因为两者需要相同的全局符号: 以点分割,需要输入更长的字符,解析时间也更长: 全局构造 ...