On Sunday December 09, 2007 at 03:13:32 (PM) Hrvoje Niksic wrote: > Gerard <[EMAIL PROTECTED]> writes: > > >> In particular, if Wget chooses not to download a file because the > >> local timestamp is still current, or because its size corresponds > >> to that of the remote file, these should result in an exit status > >> of zero. > > > > I disagree. If wget has not downloaded a file, exiting with zero > > could lead the end user to believe that it had. > > Specifying `-n' means "download if needed". There is no reason to > report a non-zero exit status if there was no need to perform the > download. It is simply not an error condition, it is one of the two > success conditions (the other being download of the new contents).
I am fully aware of what the '-n' flag is designed to do. The problem is that there is no elequent way from within a script to determine whether or not wget did in fact download a newer version of a file. I fail to see what is so hard to understand regarding this concept. Presently, I am forced to keep mutilple copies of files in different directories and then using various scripting techniques, determine if wget downloaded a newer version. > > > I disagree again. If wget did not download a file, no matter what > > the reason, then it should not exit with zero. I have written > > several scripts that utilize wget to download files. Because wget > > fails to issue a useful code upon completion, I am forced to use > > hacks to find out what actually transpired. Curl utilizes certain > > error codes, # 73 for instance, that are quite useful. > > I agree that Wget should allow the caller to find out what happened, > but I don't think exit codes can be of much use there. For one, they > don't allow distinction between different "successful" conditions, > which is a problem in many cases. Also, their meaning is much harder > to define in presence of multiple downloads (wget URL1 URL2...). Again, I disagree. Example: 0 All files downloaded successfully 1 File newer on server - file downloaded 2 No newer file on server - no file downloaded Obviously the error codes would (should) be much more detailed than that. See the 'curl' exit codes as an example. I have made suggestions regarding just this matter on their forum and have received positive feedback. In the case of multiple downloads, wget should issue a separate code for each item. I fail to see the problem with that approach. If this was in a script, I would supply wget with each item individually for finer grain control; however, I believe it is still doable from the command line.If not, then disabling exit codes except for 'zero' = all success and '99' = one or more files failed, might be a possible solution. -- Gerard