Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resume interrupted download automatically in curl?

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 
like image 879
Bili the big Avatar asked Nov 01 '13 14:11

Bili the big


People also ask

How do I continue an interrupted download?

Press Ctrl + J or click the Options dropdown menu and select Downloads to open the download manager. In the list of downloads, find the failed item and click Resume. If everything goes to plan, your download will resume from where it got interrupted.

Why are my downloads being interrupted?

Internet connectivity or stability issues Issues with Internet connectivity and the stability of the connection can cause downloads to fail, especially if the Internet connection is interrupted. When an Internet connection is unstable, it may disconnect and reconnect intermittently.

How do I Unpause download manager?

Downloads - Go to Settings >> Apps>> 'All' tab >> Select Downloads - Force stop if the button is active.

How do I continue download in wget?

there is a "--continue" option available for wegt, to continue getting a partially downloade file. This is useful when you want to finish a download started by a previous instance of wget. Make sure you run the wget command with the --continue option in the same directory where the first download started.


1 Answers

curl -L -O your_url 

This will download the file.

Now let's say your connection is interrupted;

curl -L -O -C - your_url 

This will continue downloading from the last byte downloaded

From the manpage:

Use "-C -" to tell curl to automatically find out where/how to resume the transfer. It then uses the given output/input files to figure that out.

like image 174
Jithin Avatar answered Sep 29 '22 14:09

Jithin