Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Web 服务器上有一堆 50 个 .rar 文件,我想全部下载。而且,这些文件的名称除了 .rar 之外没有任何共同之处。
我想尝试 aria2 将它们全部下载,但我想我需要编写一个脚本来获取所有 .rar 文件的地址。
我不知道如何开始编写脚本。任何提示将不胜感激。
您可以尝试在 shell 脚本中使用带有 -A 参数的 wget:
wget -r "https://foo/" -P /tmp -A "*.rar"
这是对 -A 作用的解释
指定要接受或拒绝的文件名后缀或模式的逗号分隔列表(请参阅文件类型)。请注意,如果任何通配符“<em>”、“?”、“[”或“]”出现在 acclist 或 rejlist 的元素中,它将被视为模式,而不是后缀。在这种情况下,您必须将模式括在引号中以防止您的 shell 扩展它,例如在 '-A ".mp3"' 或 '-A '*.mp3'' 中。