How to force wget to overwrite an existing file ignoring timestamp?

Andrew  Nexintong picture Andrew Nexintong · May 24, 2015 · Viewed 65.5k times · Source

I tried '-N' and '--no-clobber' but the only result that I get is to retrieve a new copy of the existing example.exe with number a number added using this synax 'example.exe.1'. This is not what I'd like to get. I just need to download and overwrite the file example.exe in the same folder where I already saved a copy of example.com without that wget verifies if the mine is older or newer respect the on example.exe file already present in my download folder. Do you think is i possible or I need to create a script that delete the example.exe file or maybe something that change his modification date etc?

Answer

PeterSW picture PeterSW · May 24, 2015

If you specify the output file using the -O option it will overwrite any existing file.

For example:

wget -O index.html bbc.co.uk

Run multiple times will keep over-writting index.html.