http://www.perlmonks.org?node_id=996343


in reply to Reading every file in a directory

I'm really tired and maybe missing something, but is there any reason you can't just run this in the shell?

 find /path/to/dir -mtime +5 -type f|xargs rm

If the files are only getting updated when the user last logs in then that's a perfectly acceptable solution and doesn't involve you having to parse the files in question.

(ninja edit - add restrict to files)