[SOLUTION][SunHELP] Quick script


Tue Oct 1 09:47:07 CDT 2002


Sorry for the confusion, I actually meant files not modified in the last 30
days. I actually needed to run this command to remove log files in an
archive directory we have for one of our applications. We had log files from
October of last year until last night, so I wanted to "purge" all of the log
files older than 30 days. The command I used was:

#find . ! -mtime -30 | /usr/bin/xargs rm -rf

Thanks for all the quick responses, this list is Da Bomb !!

> -----Original Message-----
> From: Sheldon T. Hall [mailto:shel at cmhcsys.com]
> Sent: Tuesday, October 01, 2002 10:37 AM
> To: Simoncini, Matthew
> Subject: Re: [SunHELP] Quick script
> 
> 
> 
> "Simoncini, Matthew" <Matthew.Simoncini at bsci.com> said
> 
> > I'm sorry to ask this question, but I don't have the time 
> to investigate
> > this myself. I'm looking for a quick script that'll find 
> files older than
> 30
> > days in one directory. The script doesn't need to recurse 
> through any
> > subdirectories, just the one that is supplied as an argument.
> 
> The find command will do that, but you have to decide what you mean by
> "older than" ... I don't think Unix preserves the creation 
> date of a file,
> just the times it was last accessed or modified.
> 
> Something like
> 
>     find /tmp -atime +30
> 
> would find everything in /tmp and its subdirectories that hadn't been
> accessed in 30 days.
> 
> Find has a bunch of options to restrict the search, too.
> 
> -Shel



More information about the SunHELP mailing list