I don't know if this is what you actually need but why don't you try to play with cURL
-z option:
-z/--time-cond <date expression>
(HTTP) Request a file that has been modified later than the given time and date, or one that has been modified before that time. The date expression can be all sorts of date strings or if it doesn't match any internal ones, it tries to get the time from a given file name instead!
See man curl for more details if needed.
Now, this one is really off-topic but just for fun (linux is about having fun after all

), I'm going to use the
-R option to download the srclist.main.bz2 from heanet and see the timestamp of that file (it'll be the same on my machine as that's what the -R does).
-R/--remote-timeWhen used, this will make libcurl attempt to figure out the timestamp of the remote file, and if that is available make the local file get that same timestamp.
- Code: Select all
[me@isis ~]$ curl -R -C - -O http://ftp.heanet.ie/pub/pclinuxos/apt/pclinuxos/2007/base/srclist.main.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 505k 100 505k 0 0 273k 0 0:00:01 0:00:01 --:--:-- 301k
[me@isis ~]$ stat srclist.main.bz2
File: `srclist.main.bz2'
Size: 517142 Blocks: 1024 IO Block: 4096 regular file
Device: 811h/2065d Inode: 1353872 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 501/ me) Gid: ( 501/ me)
Access: 2009-10-20 08:07:20.000000000 -0400
Modify: 2009-10-20 08:07:20.000000000 -0400
As you can see the file on heanet was last modified on October, 20. So it's about 5 days old
Let's get back to our problem:
We're gonna tell cURL to download the file only if it was modified later than October 24:
- Code: Select all
[me@isis ~]$ curl -z 20091024 -C - -O http://ftp.heanet.ie/pub/pclinuxos/apt/pclinuxos/2007/base/srclist.main.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
As you can see nothing happens, as that file last modified time was before October 24 so curl won't bother to download it.
But if we change the date to October 19 this is what happens:
- Code: Select all
[me@isis ~]$ curl -z 20091019 -C - -O http://ftp.heanet.ie/pub/pclinuxos/apt/pclinuxos/2007/base/srclist.main.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 505k 100 505k 0 0 286k 0 0:00:01 0:00:01 --:--:-- 317k
So, a curl line to benchmark the download of a file modified after October 20 should look like this :
- Code: Select all
[me@isis ~]$ curl -z 20091019 --max-time 3 --silent --output /dev/null --write-out %{time_total} http://ftp.heanet.ie/pub/pclinuxos/apt/pclinuxos/2007/base/srclist.main.bz2
2.284
Unless there is a way to input a time frame (that I'm not aware of but I ain't no curl expert... you can read
HERE some more info) , you'll have to write a piece of code for the time interval conversion, i.e. those 1209600 seconds have to be converted into a pure date number of the form YYYYMMDD at script runtime. That shouldn't be a problem though...
So, IMO, using
-z should solve your problem.
HTH.
Don