oct*_*pus 7 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)
Run Code Online (Sandbox Code Playgroud)
第二个忽略输出文件名,因为引用aria2c联机帮助页:
在Metalink或BitTorrent下载中,您无法指定文件名.此处指定的文件名仅在输入到aria2的URI由命令行完成而不使用--input-file, - force-sequential选项时使用.例如:
$ 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
Run Code Online (Sandbox Code Playgroud)
有什么建议?
Art*_*emB 16
尝试将文件名写入文件,然后运行"aria2c -i uri-list.txt"或将它们写入stdout并将它们传送到"aria2c -i - "
小智 15
使用 -Z 选项:
-Z, --force-sequential[=true|false] Fetch URIs in the command-line sequentially and download each URI in a separate session, like the usual command-line download utilities.
Run Code Online (Sandbox Code Playgroud)
所以在你的情况下:
aria2c -Z URL1 URL2 URL3 URL4
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9831 次 |
| 最近记录: |