Re: script help
"Chris Mason" <chris@net.ai> writes:
> I need to come up with a bash shell script that deletes all the files in a
> folder older than N days. I'm not sure how to test for file age so I can't
> get it done myself, can someone suggest a way?
use find(1) with the mtime flag, e.g.
find /tmp -type f -mtime +30 -exec rm {} \;
will remove all files in /tmp that are more than 30 days old.
--
Mike Quin
Unix Systems Support
Systems and Networks Group, University of Stirling
"Clue. You've either got it, or you work for UUnet" - seen on UKMM
Reply to: