cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: time condition -z with head -I option?

From: Morgan Read <mstuff_at_read.org.nz>
Date: Fri, 23 Mar 2007 14:39:03 +1200

Daniel Stenberg wrote:
> On Thu, 22 Mar 2007, Morgan Read wrote:
>
>> But -z doesn't seem to be operating as expected, particularly with the
>> -I --head option?
>
> Uh, what do you expect -z to do when all you ask for is --head ?
Mmmm, after playing around a bit I realise that -z probably relies on
the header for time so it'll be downloaded anyway, but if -z didn't
match then I'd hope for a suppression of the header output, as if --head
wasn't there. As it is, there's no distinction between a match and
mismatch.
...
>> So, tried greping on date last modified to provide something simple to
>> work on, but I seemed to get additional output...?
>
> ?
Yeah, realise that can be suppressed with -s

>
>> I'm trying to monitor changes to a file on an http file server from my
>> router, so can't afford a full download for comparison.
>
> Then do it like this:
>
> curl -z file -o file http://mysite.overthere/remotefile.html
>
> ... which only downloads the remote file if it is newer than your local
> copy.
Well, it requires a file on my router - which wont fit, and opens the
possibility of another file that wont fit... Of course it could be sent
off to /dev/null

In any case, I've realised a more useful function is to use -i -s and
grep the modification time. EG:
[morgan@morgansmachine ~]$ curl -s -i http://someurl/somefile.bin | grep
-a Last-Modified
Last-Modified: Mon, 19 Mar 2007 03:01:08 GMT
[morgan_at_morgansmachine ~]$

Thanks,
M.

-- 
Morgan Read
NEW ZEALAND
<mailto:mstuffATreadDOTorgDOTnz>
fedora: Freedom Forever!
http://fedoraproject.org/wiki/Overview
"By choosing not to ship any proprietary or binary drivers, Fedora does
differ from other distributions. ..."
Quote: Max Spevik
       http://interviews.slashdot.org/article.pl?sid=06/08/17/177220
RMS on fedora:
       http://fedoraproject.org/wiki/FreeSoftwareAnalysis/FSF

Received on 2007-03-23