From owner-freebsd-questions@FreeBSD.ORG Thu Dec 28 11:57:24 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CA2D416A412 for ; Thu, 28 Dec 2006 11:57:24 +0000 (UTC) (envelope-from wash@wananchi.com) Received: from ns2.wananchi.com (ns2.wananchi.com [62.8.64.4]) by mx1.freebsd.org (Postfix) with ESMTP id 101F213C46E for ; Thu, 28 Dec 2006 11:57:24 +0000 (UTC) (envelope-from wash@wananchi.com) Received: from wash by ns2.wananchi.com with local (Exim 4.64 #0 (FreeBSD 4.11-STABLE)) id 1Gztst-0009u1-N0 by authid ; Thu, 28 Dec 2006 14:57:19 +0300 Date: Thu, 28 Dec 2006 14:57:19 +0300 From: Odhiambo Washington To: Dan Nelson Message-ID: <20061228115719.GE80999@ns2.wananchi.com> Mail-Followup-To: Odhiambo Washington , Dan Nelson , freebsd-questions@freebsd.org References: <20061227155317.GC95520@ns2.wananchi.com> <20061227165444.GA46391@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20061227165444.GA46391@dan.emsphone.com> X-Disclaimer: Any views expressed in this message, where not explicitly attributed otherwise, are mine alone!. X-Mailer: Mutt 1.5.13 (2006-08-11) X-Designation: Systems Administrator, Wananchi Online Ltd. X-Location: Nairobi, KE, East Africa. User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-questions@freebsd.org Subject: Re: Calculate the time of last modification of a file X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Dec 2006 11:57:24 -0000 * 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. | >=20 | > The following code achieves the same on Linux: | >=20 | > # AGE =3D (current time) - (time of last modification of "$FILE") | > # please check your systems 'stat' command! | > AGE=3D$(($(date +%s) - $(stat -c '%Y' "$FILE"))) | >=20 | > test $AGE -lt $DELAY && { | > echo -n yes | > exit 0 | > } |=20 | You can use "stat -f '%m' $FILE", which is identical to Linux's=20 | "stat -c '%Y' $FILE" . Bang! Thank you so much, Dan! =20 Best regards, Odhiambo Washington Systems Admin, Wananchi Online Ltd. Voted ISP of the Year 2006 Computer Society of Kenya Annual Awards 30Th Nov., 2006 =AD 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) =20