使用 acclist 下载文件未按预期工作
Download files with acclist not working as excpected
我想从 https://download.osmand.net/list.php 下载与特定模式匹配的所有文件。
例如运行
wget -nd -r -A 'list.php, *Sweden_*' https://download.osmand.net/list.php
仅下载 list.php
。
如果我使用
wget -nd -r -A 'list.php, *' https://download.osmand.net/list.php
而是下载所有文件。
第一个示例中我的 acclist 有什么问题?
我不了解自己,研究这个答案我学到了一些新东西。
wget docs 说:
‘-A acclist --accept acclist’
‘-R rejlist --reject rejlist’
Specify comma-separated lists of file name suffixes or patterns to accept or reject (see Types of Files). Note that if any of the wildcard characters, ‘’, ‘?’, ‘[’ or ‘]’, appear in an element of acclist or rejlist, it will be treated as a pattern, rather than a suffix. In this case, you have to enclose the pattern into quotes to prevent your shell from expanding it, like in ‘-A ".mp3"’ or ‘-A '*.mp3'’.
‘--accept-regex urlregex’
‘--reject-regex urlregex’
Specify a regular expression to accept or reject the complete URL.
所以似乎 -A
可以用来检查扩展名,但不能用来检查 link 的完整模式。要搜索完整模式,您需要 --accept-regex urlregex
选项。
以下命令对我有用。
wget -nd -r --accept-regex 'Sweden_' https://download.osmand.net/list.php
我想从 https://download.osmand.net/list.php 下载与特定模式匹配的所有文件。
例如运行
wget -nd -r -A 'list.php, *Sweden_*' https://download.osmand.net/list.php
仅下载 list.php
。
如果我使用
wget -nd -r -A 'list.php, *' https://download.osmand.net/list.php
而是下载所有文件。
第一个示例中我的 acclist 有什么问题?
我不了解自己,研究这个答案我学到了一些新东西。
wget docs 说:
‘-A acclist --accept acclist’
‘-R rejlist --reject rejlist’
Specify comma-separated lists of file name suffixes or patterns to accept or reject (see Types of Files). Note that if any of the wildcard characters, ‘’, ‘?’, ‘[’ or ‘]’, appear in an element of acclist or rejlist, it will be treated as a pattern, rather than a suffix. In this case, you have to enclose the pattern into quotes to prevent your shell from expanding it, like in ‘-A ".mp3"’ or ‘-A '*.mp3'’.‘--accept-regex urlregex’
‘--reject-regex urlregex’
Specify a regular expression to accept or reject the complete URL.
所以似乎 -A
可以用来检查扩展名,但不能用来检查 link 的完整模式。要搜索完整模式,您需要 --accept-regex urlregex
选项。
以下命令对我有用。
wget -nd -r --accept-regex 'Sweden_' https://download.osmand.net/list.php