From owner-freebsd-questions@FreeBSD.ORG Tue Apr 8 21:03:44 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C565C37B401 for ; Tue, 8 Apr 2003 21:03:44 -0700 (PDT) Received: from thalia.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9D7A343FA3 for ; Tue, 8 Apr 2003 21:03:43 -0700 (PDT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-b135.otenet.gr [212.205.244.143]) by thalia.otenet.gr (8.12.9/8.12.9) with ESMTP id h3943EmP025538; Wed, 9 Apr 2003 07:03:32 +0300 (EEST) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.9/8.12.9) with ESMTP id h3943AcN001273; Wed, 9 Apr 2003 07:03:10 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.12.9/8.12.9/Submit) id h3942E41001256; Wed, 9 Apr 2003 07:02:14 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Wed, 9 Apr 2003 07:02:14 +0300 From: Giorgos Keramidas To: David Banning Message-ID: <20030409040214.GE650@gothmog.gr> References: <20030408151104.A32743@skytrackercanada.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030408151104.A32743@skytrackercanada.com> cc: questions@freebsd.org Subject: Re: how to find file older than... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Apr 2003 04:03:45 -0000 On 2003-04-08 15:11, David Banning wrote: > > I want to delete files that are older than 1/2 hr in a particular > directory. the only way I can think of doing it is by doing a "test" > and comparing the date to another file. I would then have to create > -that- comparison file 1/2 hour before. > > Is there an easier way? I usually rely on find to do this sort of thing: $ ls -l total 19281 -rw-rw-r-- 1 giorgos giorgos 381 Apr 9 06:31 _get.sh -rw-r--r-- 1 giorgos giorgos 13406367 Apr 8 21:27 outlook.zip -rw-rw-r-- 1 giorgos giorgos 6309248 Apr 9 06:57 mozilla-win32-1.3-elGR-installer.exe $ find . -type f -mtime -2h ./_get.sh ./mozilla-win32-1.3-elGR-installer.exe The -mtime switch accepts various units that I'm sure you'll find useful for specifying time intervals, and you can even combine them as in find -mtime 3d15h - Giorgos