wget -c (--continue): resume a partially downloaded file
- tool
- wget
- command
- wget
- flag
- -c, --continue
- default
- off (an existing file is kept and the download is saved as FILE.1)
wget -c URL continues a download that stopped part-way. If a file with the same name exists in the current directory, wget asks the server only for the bytes after the end of that file (an HTTP Range request) and appends them. Without -c, wget leaves the partial file alone and starts over, saving the new copy as FILE.1.
Usage
# first attempt is interrupted (Ctrl+C, network drop)
wget https://example.org/big.iso
# resume it
wget -c https://example.org/big.iso
# resume automatically: retry forever and wait between attempts
wget -c --tries=0 --waitretry=10 https://example.org/big.isoA connection lost in the middle of a single wget run is retried and resumed automatically; -c is for continuing a file left behind by an earlier run or by another program. Run the second command from the same directory, with the same output name (-O or the name taken from the URL), so wget finds the partial file.
What can happen
| Situation | Result with -c |
|---|---|
| Server supports Range (answers 206 Partial Content) | only the missing bytes are downloaded and appended |
| Server ignores Range (answers 200) | wget refuses to append and does not restart from scratch, to avoid corrupting the file |
| Local file is already complete | wget reports that the file is fully retrieved and does nothing |
| Remote file changed since the first attempt | wget cannot tell; the result is a mix of two versions |
Related options
| Option | Effect |
|---|---|
| -t N, --tries=N | number of retries (0 = unlimited); the default is 20 |
| --waitretry=SECONDS | wait between retries, growing up to this value |
| -nc, --no-clobber | skip files that already exist instead of downloading them again |
| -N, --timestamping | download only if the remote file is newer than the local one |
| --start-pos=OFFSET | start at a byte offset; if both are given, --start-pos wins and -c is ignored with a warning |
The curl equivalent is curl -C - -O URL, where -C - tells curl to work out the resume offset from the existing output file.