[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Timestamping
From: |
Andre Majorel |
Subject: |
Re: [Bug-wget] Timestamping |
Date: |
Wed, 23 Mar 2011 02:45:07 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On 2011-03-21 20:39 +0300, Alexander Chernyavsky wrote:
> I'm doing wget http://tex.imm.uran.ru/tex/beameruserguide.pdf -O
> beameruserguide.pdf. Download completes and ls -l shows that file is
> dated as 2005-10-23 20:48. Date command shows Mon Mar 21 20:37:56 MSK
> 2011.
>
> I'm reading in manual:
> >For this reason, -N (for timestamp-checking) is not supported in
> >combination with -O: since file is always newly created, it will always
> >have a very new timestamp.
> But in my case file has an old timestamp. I'm using -O and timestamping
> still works. Moreover, even without -N it continues to work. How can I
> turn off timestamping?
Interesting request. I would have thought that setting the mtime
of the local file according to the Last-Modified header of URL
was a feature. Anyway, if you want to find out what was just
downloaded, you could check the ctime. Assuming GNU find,
touch .timestamp &&
sleep 1 &&
wget ... &&
find . -cnewer .timestamp
You could also set the mtime to match the ctime. Again assuming
GNU find,
touch .timestamp &&
sleep 1 &&
wget ... &&
find . -cnewer .timestamp -print0 |
perl -0ne 'BEGIN { $status = 0; $| = 1; }
sub err (@) { print STDERR @_, "\n"; $status = 2; }
chomp;
@s = stat;
if (@s == 0) { err "$_: $!"; next; }
printf "%s: mtime %+.0f s\n", $_, $s[10] - $s[9];
utime $s[8], $s[10], $_ or err "$_: $!\n";
END { exit $status }'
--
André Majorel http://www.teaser.fr/~amajorel/