Ask WGET to download only the same file if the existing age is older

The question indicates how to instruct WGET to download only the same file, if the existing one is older

eg. fileA has a date / file stamp 9.00AM 10/10/2011

eg. fileA on the remote server has a date / file stamp 11AM 10/10/2011

so wget will upload FileA on the server as its new one (and overwrite the local file)

Any help would be greatly appreciated. I heard that it’s possible, but looking around, for a while I didn’t come up with anything.

+7
source share
2 answers

See the timestamping section in the wget manual:

Time stamping

One of the most important aspects of mirroring information from the Internet is updating your archives.

Downloading the entire archive again and again, just to replace the slightly modified files of the road, both in terms of bandwidth and money loss, and time for updating. This is why all mirroring tools offer an incremental upgrade option.

This update mechanism means that the remote server is scanned for new files. Only those new files will be uploaded instead of the old ones.

A file is considered new if one of these two conditions is met:

A file with this name does not yet exist locally. A file with the same name exists, but the deleted file has been modified recently than the local file. To realize this, the program must be aware of the time of the last modification of both local and remote files. We call this file timestamp information.

The time stamp in GNU Wget is enabled using '--timestamping ("-N"), or by timestamp = by directive in .wgetrc. With this option, for each file she intends to download, Wget will check if a local file with the same name exists. If it does, and the deleted file is no newer, Wget will not load it.

If the local file does not exist or the file sizes do not match, Wget will download the remote file no what the temporary marks say.

+9
source

wget -N http://server/path/to/file.txt

+5
source

All Articles