[Linux-aus] Automate old file deletion, help!

Tom Swann tom.swann at jcu.edu.au
Sun Mar 9 23:23:01 UTC 2003


Hi Folks

I've setup an area on a RH7.3 intranet server where people at work can place 
files which they think may be of interest to others.

I would like to automate a process where old files are deleted.

I believe an approach would be to use cron and tmpwatch, there may be better 
ways. But I've never used either of these before or automated such a process 
and some assistance from someone who has would be appreciated.

The files are all in a directory called attachments, or to be precise 
in /usr/attachments/

I would like to delete any file which has not been accessed for two weeks, and 
run the process once a week at a set time eg 0400 Sunday morning.

I guess I need to make a file and put it in /etc/cron.weekly but I'm not sure 
what the script in the file should read, perhaps something like:-

tmpwatch -u 336 /usr/attachments/
plus some stuff to ensure it runs at 0400 every Sunday (336 is the number of 
hours in two weeks)

I don't want e-mail confirmation that it has happened nor do I need to log the 
event.

All assistance appreciated.

Cheers
Tom
-- 
Tom Swann 
mailto:tom.swann at jcu.edu.au









More information about the linux-aus mailing list