Wednesday, June 22, 2011

Allow wget to overwrite files

Default behavior of wget is to make new files if files of same name are downloaded again, appended with a counter.

wget filename > filename
wget filename > filename.1
wget filename > filename.2

To overwrite the existing file with the new downloads without creating new files, the answer is:

On GNU Wget 1.12 built on linux-gnu:

Use wget -N filename 

2 comments:

  1. Actually -N is for comparing timestamps and will only download the file again if the timestamp is newer than your local file. What you're looking for is -r

    ReplyDelete