使用wget / aria2解析可下载的url路径

时间:2013-12-19 23:04:25

标签: bash

我想从linux命令行下载多个文件,链接结构对此https://archive.org/compress/tmg2002-10-23/formats=Flac,Metadata,Text,Checksums,Flac%20FingerPrint有兴趣,而变量部分位于中间/tmg2002-10-23/,具有不同的日期。如何使用wget / aria2等下载管理器下载所有文件?我在wget / aria2中尝试使用/ tmg * /但它只是不起作用

2 个答案:

答案 0 :(得分:1)

改编自here

for d in {0..365}
do
    dt=$(date -d "2012-01-01 + $d days" +'%Y-%m-%d')
    wget "https://archive.org/compress/tmg$dt/formats=Flac,Metadata,Text,Checksums,Flac%20FingerPrint"
done

将“2012-01-01”更改为您要开始的日期,并将更改365作为开始日期之后的下载天数。 date函数已经为您处理了闰年。

答案 1 :(得分:0)

例如

for i in "2002-10-23" "2002-10-22"
do wget "https://archive.org/compress/tmg${i}/formats=Flac,Metadata,Text,Checksums,Flac%20FingerPrint"
done

您应该为wget包含正确的选项。当然,剧本可能要复杂得多。