Here's one way,
That uses the file test operators to check if each name rperesents an ordinary file, and to see if the file is more than 30 days old. Adjust $days (can be fractional) for age, and the argument of glob for path and any specializations like file extension.my $days = 30; for (glob '*') { unlink if -f and -M > $days; }
After Compline,
Zaxo
In reply to Re: Deleting files based on date
by Zaxo
in thread Deleting files based on date
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |