Hello all.

I also noticed lack of documentation of the return value for wget in its man and info pages. From the code, it looks like 0 is success, and anything else is 1.

I use wget to get a file from the web, and when it's new I want to do some processing on it. Ideally, I could run:
wget -N http://www.foo.com/foo.txt
and use the return code to me to let me know if my copy of the file as changed. I get an exit status of 0 in either case, presumably because the program has terminated normally (using v1.9.1).


I hacked up a quick patch to the source that will ultimately return 1 if the file isn't downloaded because it hasn't changed from your local copy. I've not tested it when you try to retrieve multiple files in one command, but in theory I set it to return 0 whenever any file is downloaded, and 1 only when no files are downloaded because of this situation. For single file requests, my patch works as I would expect.

Some questions:
1. Does this functionality already exist somewhere ? I searched both info and man pages but saw nothing to indicate that it does.
2. Would anyone else find this feature useful ?
3. Should I propose this enhancement to the patches list or elsewhere ?


Currently I download to a temp file, diff the temp file against my previously downloaded copy, and then if it differs overwrite my copy with the temp file and run my processing job. With this feature, I can just get to my local copy, and if I get a returncode of 0, do my processing. That seems much simpler.

Geoff

Reply via email to