Click to See Complete Forum and Search --> : Scheduled deleting of files


jje
02-11-2004, 09:09 AM
I need to automaticly delete files older than 14 days i SUSE 9.0
How do I schedule/do that?


/Jan

JohnT
02-11-2004, 09:14 AM
You schedule it by running a cron job.....look under
man crontab in your terminal.
http://www.deluxnetwork.com/linux/guides/crons.php

Icarus
02-11-2004, 10:22 AM
find /tmp -type f -mtime 14 -exec rm -f {}\;

or

find /tmp -type f -atime 14 -print | xargs -- rm -f --


I use something simular to the first on on HP-UX, I've never tested it on Linux. The second one does the same but looks for Access Time (the first one looks for modified time).

man find for full details

This is also recursive...so it will dig into subdirectories