tldr/pages.zh/common/wget.md

38 lines
1.2 KiB
Markdown
Raw Normal View History

2019-08-15 01:45:57 +01:00
# wget
2019-10-18 04:30:29 +01:00
> 从网络上下载文件.
2019-08-15 01:45:57 +01:00
> 支持 HTTP, HTTPS, 和 FTP.
2019-10-18 03:33:27 +01:00
> 更多信息:<https://www.gnu.org/software/wget>.
2019-08-15 01:45:57 +01:00
2019-10-20 03:34:33 +01:00
- 将该 URL 的内容下载到文件中 (在这个例子中文件名为 "foo":
2019-08-15 01:45:57 +01:00
`wget {{https://example.com/foo}}`
2019-10-20 03:34:33 +01:00
- 将该 URL 的内容下载到文件中 (在这个例子中文件名为 "bar":
2019-08-15 01:45:57 +01:00
`wget -O {{bar}} {{https://example.com/foo}}`
2019-10-18 03:33:27 +01:00
- 以每三秒一个请求的速度下载一个网页和其所有资源 (脚本,样式表,图片等等):
2019-08-15 01:45:57 +01:00
`wget --page-requisites --convert-links --wait=3 {{https://example.com/somepage.html}}`
2019-10-18 03:33:27 +01:00
- 从一个目录中下载所有列出的文件和其所有子文件夹 (不下载内嵌网页):
2019-08-15 01:45:57 +01:00
`wget --mirror --no-parent {{https://example.com/somepath/}}`
2019-10-19 07:12:27 +01:00
- 限制下载速度和重试次数:
2019-08-15 01:45:57 +01:00
`wget --limit-rate={{300k}} --tries={{100}} {{https://example.com/somepath/}}`
2019-10-19 07:12:27 +01:00
- 使用基本授权来从 HTTP/FTP 服务器中下载文件:
2019-08-15 01:45:57 +01:00
`wget --user={{username}} --password={{password}} {{https://example.com}}`
2019-10-19 07:12:27 +01:00
- 继续一个未完成的下载任务:
2019-08-15 01:45:57 +01:00
`wget -c {{https://example.com}}`
2019-10-19 07:12:27 +01:00
- 将指定文件中所有列出的 URL 下载到一个目录中:
2019-08-15 01:45:57 +01:00
`wget -P {{path/to/directory}} -i {{URLs.txt}}`