Click to See Complete Forum and Search --> : [RESOLVED] Removal of expired files script


valanto
03-05-2007, 06:57 AM
After searching the web and finding very few unsatisfactory results...
Can I have a script that automatically removes files from a folder that are older than a specified time period (i.e. a week). If this is possible, how?

Thank you,
Valanto

JulesH
03-05-2007, 03:53 PM
If you're on a Unixy server, something like:

find -mtime +7 -exec rm '{}' ';'

should do the job. Use 'find -mtime +7 -print' to see what it would delete before you use it.

valanto
03-06-2007, 07:19 AM
Thank you!
I think that should do it. It prints out the correct files. I'll put it to the test now

Again thank you:)
Valanto