[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Help with shell script



On Thu, 2003-07-31 at 12:11, Jonathan Bartlett wrote:
> > I'd appreciate if you can guide me/help me on a script on deleting files/directories more than two days old on Redhat servers.
> 
> find WHATEVER -mtime +2 -type f -exec rm \{} \;
> 
> substitute WHATEVER with the top-level directory you want to purge on.
> Follow this with.
> 
> find WHATEVER -mtime +2 -type d -exec rm -f \{} \;
> 
> Which will delete empty directories which haven't been modified for two
> days.
> 
> DISCLAIMER: Test these before use.  I provide no guarantees that anything
> here will work as promised.  This is provided merely as an aid to help you
> develop your own system.  No implication of usefulness is made by my post.
> 
> Jon
I figured, I'd kill 2 birds with one stone...

find / -mtime +2 -type d -exec rm -rf \{} \;

I wonder how long that will run before it eats itself?  Hasn't anyone
wanted to do that just to see...
;)

*Note: The above line is a joke, please don't run it on your system

-- 
Michael Gargiullo <mgargiullo warpdrive net>
Warp Drive Networks




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]