hi there,

i try to look a little bit behind the fetching programs, you use. I want to get an errorcode, if the file doesn't exist anymore (new versions like rsync and ncftp last days). I realizes that curl doesn't gives any errorcode, if the file is not there. Currently it writes the 404-error-code-webpage into the file it should normally fetch :-)) nice behaviour, but unfortunally undesired).

It is possible to output the http errorcode with:
curl -w 'HTTP-Code was: %{http_code}\n' -L -O http://rsync.samba.org/ftp/rsync/rsync-2.5.1.tar.gz
but the overall errorcode of the programm stays 0.

why you don't use wget for downloading the files? I didn't see anything you need, wget is able to do (maybe there is a reason you tell me here :-)). And a big advantage: wget returns a real errorcode:

% wget http://rsync.samba.org/ftp/rsync/rsync-2.5.1.tar.gz
--09:24:10-- http://rsync.samba.org/ftp/rsync/rsync-2.5.1.tar.gz
=> `rsync-2.5.1.tar.gz.1'
Resolving localhost... done.
Connecting to localhost[127.0.0.1]:8080... connected.
Proxy request sent, awaiting response... 404 Not Found
09:24:11 ERROR 404: Not Found.

% echo $?
1

joseph

Reply via email to