使用通配符通过 wget 下载文件列表

使用通配符通过 wget 下载文件列表

我有一个文件列表,例如:

test.com/image01.png
test.com/image02.png
test.com/image03.png
...
test.com/image50.png

并希望下载所有文件。一种方法是将所有文件名称写入一个文件,然后:

$ wget -i url.txt

但是对于 50 个链接(至少),将其全部写入一个文件有点太长了(即使通过复制和粘贴,我也必须编辑一行 49 次。)

我测试了类似的东西:

$ wget test.com/image[01-50].png
Warning: wildcards not supported in HTTP.
--2019-09-22 01:45:43--  test.com/image[01-50].png
Resolving test.com (test.com)... 12.12.12.12
Connecting to test.com (test.com)|12.12.12.12|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-09-22 01:45:43 ERROR 404: Not Found.

如何在 中使用通配符wget?我应该使用任何开关吗?

答案1

根据约翰1024,括号扩展是解决方案:

$ wget test.com/image{01..50}.png 

答案2

对于 Firefox 网页的文件列表,有一个 Firefox 扩展 Linkgopher,它将为您提供带有链接的页面,然后您可以将其保存到文本文件中。它接受过滤器。 https://sites.google.com/site/linkgopher/

正如您所知,wget 可以将文本文件作为输入

这是我的,<> 表示您输入或删除该参数,编辑:那些括号没有出现,所以如果没有给出参数,请输入一个或删除它。

wget --input-file= --show-progress --limit-rate=200K --random-wait --no-directories --continue --rejected-log= --output-file= --directory-prefix= --user= --password=

相关内容