Tuesday, January 22, 2008

cleaning up the filesystem

a mundane task - but why do I keep finding servers with disks almost full - because someone had a cron job - logging or saving out some data - but didn't put in anything to cleanup after themselves. The following will delete files from a destination after 14 days:

find /some/location/ -mtime +14 -exec rm {} \;

wasn't that hard was it?

The sensible thing is to test it non-destructively first by the way...so exec ls or something harmless for testing.