When doing wget -c http://example.com/foo to periodically update a file, is there any way to get an error status from wget if the file has not been updated since last download?

Something like:

$ wget --give-error-if-file-is-not-updated -c http://example.com/foo
$ echo $?

Wget calls this feature "time-stamping". It's documented at https://www.gnu.org/software/wget/manual/wget.html#Time_002dStamping. To use it, just add -N or --timestamping to your command line: wget --timestamping -c http://example.com/foo.

  • wget -N returns status 0 (which means "no error") when the file is not modified, at least when I tried. Please elaborate. – forthrin Sep 15 '18 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.