在 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/