Wget: checking file timestamp and overwriting

How can I get wget for this:

Download the file from the say x location only if the local copy of the file has an older timestamp than the one indicated on the file's timestamp at x . This means that it should download the file from the specified location only if there is a newer version of the file.

If there is a newer version of the file, wget should overwrite the file.

Can this be done?

+4
source share
1 answer

It looks like you are looking for TimeStamping functionality for wget: http://www.gnu.org/software/wget/manual/wget.html#Time_002dStamping

Say you want to upload a file so that it saves its modification date.

 wget -S http://www.gnu.ai.mit.edu/ 

A simple ls -l indicates that the timestamp in the local file is equal to the Last-Modified header status returned by the server. As you can see, time stamping information is stored locally, even without '-N (at least for http).

A few days later, you would like Wget to check if the deleted file has been modified and upload it if there is one.

 wget -N http://www.gnu.ai.mit.edu/ 
+2
source

All Articles