in reply to Finding Oldest File in a Directory

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