Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: how to purge the files that are older than 90 days

Re: how to purge the files that are older than 90 days

From: joel garry <joel-garry_at_home.com>
Date: 7 Sep 2006 14:17:40 -0700
Message-ID: <1157663859.974609.280220@i42g2000cwa.googlegroups.com>

HansF wrote:
> On Thu, 07 Sep 2006 09:18:05 -0700, muddu wrote:
>
> > Hi All ORA DBA's,
> >
> > I am in need of a unix shell script that will purge(clean up) all the
> > files from history that are older than 90 days.
>
> It's not a shell script. That's a single command.
>
> man find
>
> to get the details - start with the following pattern:
>
> find /dir -mtime 90 -a -type f -exec rm {} \;
>
> and test, test, test.

Actually, with such a dangerous command, you probably do want to run it in a script, with ls -l instead of rm first, then a "sure delete these?" question (or at least output to a file if for a cron). For example, a cron to remove old arcs:

49 03 * * * find /noimnotgoingtoshowmyrealdirectory/arch -type f -mtime +2 -exec ll {} \; >> /home2/oracle/archfilerm ; find /noimnotgoingtoshowmyrealdirectory/arch -type f -mtime +2 -exec rm {} \;

I've noticed the various times that find finds don't work exactly as documented on some systems. Your command doesn't find any files on my hp-ux system, for example. Though +90 does, because 90 means exactly 90 and +90 means greater than 90. I suppose you did that on purpose to make this a learning experience? :-)

jg

--
@home.com is bogus.
http://oracledoug.com/serendipity/index.php?/archives/1072-If-youre-gonna-screw-up-....html
Received on Thu Sep 07 2006 - 16:17:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US