Add this and see what happens:
if( -f $file and $file =~ /BOT/ ) { # ^^^^^^^^ <----- Add this test.
I think the problem is that readdir returns everything in the directory, including other directories.
By the way; mtime is not the same as the file's age.
Dave
In reply to Re: Finding Oldest File in a Directory
by davido
in thread Finding Oldest File in a Directory
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |