Date: Thu, 28 Dec 2006 14:57:19 +0300 From: Odhiambo Washington <wash@wananchi.com> To: Dan Nelson <dnelson@allantgroup.com> Cc: freebsd-questions@freebsd.org Subject: Re: Calculate the time of last modification of a file Message-ID: <20061228115719.GE80999@ns2.wananchi.com> In-Reply-To: <20061227165444.GA46391@dan.emsphone.com> References: <20061227155317.GC95520@ns2.wananchi.com> <20061227165444.GA46391@dan.emsphone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
* On 27/12/06 10:54 -0600, Dan Nelson wrote:
| In the last episode (Dec 27), Odhiambo Washington said:
| > I am trying to determine the time of last modification of a file, on
| > FreeBSD.
| >
| > The following code achieves the same on Linux:
| >
| > # AGE = (current time) - (time of last modification of "$FILE")
| > # please check your systems 'stat' command!
| > AGE=$(($(date +%s) - $(stat -c '%Y' "$FILE")))
| >
| > test $AGE -lt $DELAY && {
| > echo -n yes
| > exit 0
| > }
|
| You can use "stat -f '%m' $FILE", which is identical to Linux's
| "stat -c '%Y' $FILE" .
Bang!
Thank you so much, Dan!
Best regards,
Odhiambo Washington
Systems Admin,
Wananchi Online Ltd.
Voted ISP of the Year 2006
Computer Society of Kenya Annual Awards
30Th Nov., 2006 Panari Hotel, Nairobi
DISCLAIMER: See http://www.wananchi.com/bms/terms.php
----------------------------------+-----------------------------------------
Odhiambo WASHINGTON . WANANCHI ONLINE LTD (Nairobi, KE)
http://www.wananchi.com/email/ . 1ere Etage, Laptrust Plaza, Loita St.,
Mobile: (+254) 722 743 223 . # 10286, 00100 NAIROBI
----------------------------------+-----------------------------------------
``It is always the best policy to speak the truth --
unless, of course, you are an exceptionally good liar.'' (Jerome K Jerome)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061228115719.GE80999>
