Date: Tue, 28 Aug 2001 15:43:07 +0200 From: "Patrick O'Reilly" <patrick@mip.co.za> To: <freebsd-questions@FreeBSD.ORG> Subject: RE: shell script to remove dated files Message-ID: <NDBBIMKICMDGDMNOOCAICEBBDGAA.patrick@mip.co.za> In-Reply-To: <01082808372107.26623@i8k.babbleon.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?NDBBIMKICMDGDMNOOCAICEBBDGAA.patrick>