From owner-freebsd-questions Tue Aug 28 6:41:50 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mip.co.za (puck.mip.co.za [209.212.106.44]) by hub.freebsd.org (Postfix) with ESMTP id F2A9E37B406 for ; Tue, 28 Aug 2001 06:41:27 -0700 (PDT) (envelope-from patrick@mip.co.za) Received: from patrick (patrick.mip.co.za [10.3.13.181]) by mip.co.za (8.9.3/8.9.3) with SMTP id PAA24258 for ; Tue, 28 Aug 2001 15:41:15 +0200 (SAST) (envelope-from patrick@mip.co.za) From: "Patrick O'Reilly" To: Subject: RE: shell script to remove dated files Date: Tue, 28 Aug 2001 15:43:07 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal In-Reply-To: <01082808372107.26623@i8k.babbleon.org> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG OK, a change of direction: Personally, I am quite a fan of newsyslog (see the man page). The only catch is that you need to have known file names! If your requirement involves trashing files whose names are variable, this might not help. By default it is used to keep things in order in /var/log , but there's no reason not to use it elsewhere. And it has 'kool' features, like rolling 'file' to 'file.0', then to 'file.1', etc. and you can limit it by size, or by time, etc. Just my 2c worth. Patrick. On Tuesday 28 August 2001 06:04, Paul Branston wrote: > On Tue, Aug 28, 2001 at 05:31:44AM +0800, David Okeby wrote: > > Hi, > > > > How do I write a shell script that removes old files? Say something of > > the order of two weeks old. > > > > Thanks > > > > David > > david@okeby.com > > have a read at the find man page. You need somethimg like > > find /path -mtime +14 -exec rm {} \; I recommend -atime instead. THis way if they've been reading it, it won't vanish on them. Of course it depends on the purpose of the script. > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- Brian T. Schellenberger . . . . . . . bts@wnt.sas.com (work) Brian, the man from Babble-On . . . . bts@babbleon.org (personal) --------------------> Free Dmitry Sklyarov! <------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message