|P is for Practical|
Finding a file by age (Newest First)by ChuckularOne (Parson)
|on Jun 04, 2004 at 17:16 UTC||Need Help??|
ChuckularOne has asked for the
wisdom of the Perl Monks concerning the following question:
I'm was trying use File::Finder to find a filename that is the X oldest file that matches a starting string. (I failed miserably...)
So I abandoned that and am trying anything that might work...
Here's an example:
from the directory listing;
where the files were created in chronological order.
If I pass the parameters "te" and "2" it would return test1.
I'm running perl v5.6.0 built for aix.
This is the code I came up with so far. It will create a list based on the regex for the name and find the Xth file based on position in the list. I need that list to be in chronological order.
=====================(( U P D A T E ))=====================
Thanks to everyone for there input. I implemented Zaxo's
code and it does exactly what I need.
Thanks for the quick results.