in reply to Get newest file

That's a lot of files, and a lot of stat calls if you do this by brute force. How about changing the organization to put new files in a holding directory? You can then check dates, process, and move the files from there.

If you must do this, check File::Find and note that the mtime of a directory matches that of its newest file (for static files).

After Compline,
Zaxo