bash - 使用自定义文件名同时(并行)下载多个文件

标签 bash curl wget aria2

在 bash 脚本中,我尝试使用单个 命令(无循环)并行 下载多个文件,使用自定义文件名 .

我尝试使用 aria2c:

aria2c -j2 URL1 URL2                # BAD: outputs to a single file

aria2c -j2 -Z URL1 -o 1 URL2 -o 2   # BAD: filenames taken from link (-o is ignored)

第二个忽略输出文件名,因为引用 aria2c 联机帮助页:

In Metalink or BitTorrent download you cannot specify file name. The file name specified here is only used when the URIs fed to aria2 are done by command line without --input-file, --force-sequential option. For example:

$ aria2c -o myfile.zip "http://example1.com/file.zip" "http://example2.com/file.zip"

这是我想避免的:

aria2c URL1 -o 1 &
aria2c URL2 -o 2 &
aria2c URL3 -o 3                     # BAD: slow and ugly, because aria2c is called thrice

有什么建议吗?

最佳答案

Aria2c supports getting URIs from a file .

尝试将您的文件名写入文件,然后运行“aria2c -i uri-list.txt”或将它们写入标准输出并将它们通过管道传输至“aria2c -i -”

关于bash - 使用自定义文件名同时(并行)下载多个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20156931/

相关文章:

swift - 用 Perfect CURL Swift 解析

bash - cURL 将 JSON 作为 x-www-form-urlencoded 发送

ubuntu - 无法通过curl使用nova,需要身份验证

bash - 将整个提交复制到单独的目录中

Linux shell 将变量值传递给主程序

regex - Bash:提取文件名的数量以移动到编号正确的目录中

linux - 隐藏命令未找到 bash 脚本

https - 如何使用 wget 从 S3 存储桶下载文件?

curl - 在身份验证方面,curl 与 wget 有何不同

linux - 无法在 Ubuntu 14.04 LTS 上通过 wget 建立 SSL 连接