10

When downloading a file over a problematic connection, wget fails, and retries. However, it retries from zero, throwing away the previously downloaded part of the file.

$ wget https://www.example.com/file
file          8%[========>                                                                                               ]   2,45M  78,9KB/s    in 32s     

2020-04-01 15:09:18 (78,9 KB/s) - Connection closed at byte 2965504. Retrying.

file         97%[====================================================================================================>   ]  27,09M  50,8KB/s    in 7m 12s  

2020-04-01 15:16:31 (64,3 KB/s) - Connection closed at byte 28409856. Retrying.

file          3%[===>                                                                                                    ]   1,09M  23,2KB/s    in 48s     

and so on

How do I get it to restart from where it got to, instead of starting from zero? I tried wget -c --retry-connrefused, but got the same behavior.

1

1 Answer 1

14

I stumbled upon this question in search of a way to handle progressive downloads and here's the command I used to workaround my issue.

wget --continue --progress=dot:mega --tries=0 <url>

The continue option tells wget to try and restart any downloads where they left off. The progress option indicates 3MB per line of dots rather than 384k; appropriate for a file of my size ~1GB. And finally, tries=0 means keep trying forever regardless of how many times the connection fails. If the server closes the connection unexpectedly or you lose connectivity you can easily re-run the command to download where you left off. Hopefully, this works for your use case as well.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.