0

我的研究所不允许下载超过 300MB 的文件,所以我想出了这个分段下载文件的技巧!现在我想简化任务并在 python 中制作一个脚本!我正在使用 os.system() 来执行命令!

我的计划是使用这个 curl --range 300000000*X-(300000000*(X+1)-1) [url] -o filename.partX # X 是零件号

但我不知道如何终止循环!我怎么知道文件的所有可用部分都已下载!谁能帮我解决这个问题?

4

1 回答 1

0
# repeat download if fail to download the big file
until curl -C - -o partial_file.zip http://example.com/file.zip; do
    echo Tansfer disrupted, retrying in 10 seconds...
    sleep 10
done
于 2018-09-29T12:14:02.673 回答