I have been trying to figure out a way to make wget only create a file if the actual download response is valid, meaning no 404 or 500 status code, only 200.
However, when using the -O option (to specify filename) it will always create the file, with the content of the error page, and I haven't found a way to specify that it should ignore it if it recieves a 404 response-header.
Do I need to check the exit-code and pipe the output or is there a better alternative?