sort it by age, reverse it, and shift the first filename from the array, then unlink it.
If you are doing a stat and you have a ton of files, consider first getting all the stat into into a hash for all the files, then sorting, otherwise your sort will be running multiple stat for each file. Which is slow on a ton of files.
In reply to Re: Deleting by Age!
by leocharre
in thread Deleting by Age!
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |