Purge Old Files Script

Robert Meyer meyer_rm at yahoo.com
Mon Sep 30 11:19:06 EDT 2002


Not a good idea to start any find with 'rm' at the root
directory, especially if you're root.  Bad things can ensue.

Also, depending on the shell, you may have to escape the '{}' chars
or the shell will try to interpet them.

Cheers!

Bob
--- Mark Musone <mmusone at shatterit.com> wrote:
> Essentially all you need is something to the effect of:
> 
> 
> find / -atime X -type f -exec rm {} \;
> 
> Put that in a cron job, and that should be all you need!!
> 
> P.s. the atime and x is kinda relative to your needs, when you say
> older,
> Do you mean not accessed or not modified..etc..check the man on find for
> all the options..
> 
> -Mark
> 
>  
> 
> -----Original Message-----
> From: owner-nflug at nflug.org [mailto:owner-nflug at nflug.org] On Behalf Of
> Justin Bennett
> Sent: Monday, September 30, 2002 10:23 AM
> To: nflug at nflug.org
> Subject: Purge Old Files Script
> 
> 
> I'm looking for a script to delete files older than x number of days.
> There is an area on our samba server thats rw for everyone, where users
> put stuff temporaily for others to get at. It's getting out of control
> lots of old stuff. I want to have a script that blows away old stuff. I
> supose I could write something, just wondering anyone has something
> they'd be willing to share.
> 
> Thanks,
> Justin
> 
> -- 
> -------------------------------------------
> Justin Bennett
> Red Hat (Linux) Certified Engineer
> Network Administrator
> Dynabrade Inc.
> 8989 Sheridan Dr
> Clarence, NY 14031
> 716-631-0100 ext 215
> 
> 

=====
Bob Meyer
Knightwing Communications, Inc.
36 Cayuga Blvd
Depew, NY 14043
Phone: 716-308-8931 or 716-681-0076
Meyer_RM at Yahoo.com

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com



More information about the nflug mailing list