Purge Old Files Script
Robert Meyer
meyer_rm at yahoo.com
Mon Sep 30 11:16:49 EDT 2002
find /home/samba/shareplace/whatever -mtime +3 -print | perl -ne 'chop;unlink;'
Where the '-mtime +3' refers to anything that hasn't been modified in the
last three days and the perl script collects the names, chops off the newline
and unlinks the filenames. You could also use "-exec /bin/rm '{}' ';'"
args to the find command but that execs potentially zillions of 'rm'
commands.
Cheers!
Bob
--- Justin Bennett <Justin.Bennett at dynabrade.com> wrote:
> 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