本文介绍了如何在curl中自动恢复中断的下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Linux中使用 curl 。我正在ftp服务器上下载文件的一部分(使用 -r 选项),但是连接不好,它总是会中断。我想编写一个脚本,当我再次连接时可以继续下载。

I'm working with curl in Linux. I'm downloading a part of a file in ftp server (using the -r option), but my connection is not good, it always interrupts. I want to write a script which resume download when I'm connected again.

我使用了此命令,但是它不起作用:

I've used this command, but it's not working:

until curl -r 666-9999 -C - --retry 999 -o "path/to/file" "ftp:/path/to/remote/file"; do :; done


推荐答案

curl -L -O your_url

这将下载文件。

现在,假设您的连接已中断;

Now let's say your connection is interrupted;

curl -L -O -C - your_url

此操作将从下载的最后一个字节继续下载

This will continue downloading from the last byte downloaded

来自手册页:

这篇关于如何在curl中自动恢复中断的下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 10:14
查看更多