Hi PerlMonks,
I have a list containing the file names in the following format,
/devLog/devid234/term_logs/devid234.2009-08-27-23-55-11.terminal.log.tar.gz
/devLog/devid234/term_logs/devid234.2009-08-27-15-05-06.terminal.log.tar.gz
/devLog/devid234/term_logs/devid234.2009-08-27-01-45-03.terminal.log.tar.gz
/devLog/devid234/term_logs/devid234.2009-08-28-00-00-01.terminal.log.tar.gz
/devLog/devid234/term_logs/devid234.2009-08-28-18-25-04.terminal.log.tar.gz
/devLog/devid168/term_logs/devid168.2009-08-28-01-35-02.terminal.log.tar.gz
/devLog/devid168/term_logs/devid168.2009-08-27-04-02-01.terminal.log.tar.gz
/devLog/devid168/term_logs/devid168.2009-08-28-20-25-01.terminal.log.tar.gz
/devLog/devid168/term_logs/devid168.2009-08-27-17-55-01.terminal.log.tar.gz
/devLog/devid918/term_logs/devid918.2009-08-27-21-15-01.terminal.log.tar.gz
/devLog/devid918/term_logs/devid918.2009-08-27-13-25-01.terminal.log.tar.gz
/devLog/devid918/term_logs/devid918.2009-08-27-00-00-01.terminal.log.tar.gz
/devLog/devid918/term_logs/devid918.2009-08-28-00-00-02.terminal.log.tar.gz
/devLog/devid918/term_logs/devid918.2009-08-28-09-45-01.terminal.log.tar.gz
/devLog/devid918/term_logs/devid918.2009-08-28-19-25-01.terminal.log.tar.gz
/devLog/devid167/term_logs/devid167.2009-08-28-02-45-01.terminal.log.tar.gz
/devLog/devid167/term_logs/devid167.2009-08-27-01-45-02.terminal.log.tar.gz
/devLog/devid167/term_logs/devid167.2009-08-27-10-55-01.terminal.log.tar.gz
The file name will have the timestamp in YYYY-MM-DD-hh-mm-ss format.
The above list is created by reading a dir recursively using File::find ,
sub process_file {
push( @LogAnalyser::LogFileList, $File::Find::name )
if /terminal.log.tar.gz$/;
}
find( \&process_file, "$log_dir" );
Now my question is to have all the filenames in each devid directory in the list sorted based on the timestamp in the log file name,
so that when i read every file from the list for processing , all the files are read sequentially with respect to time.
.
I tried to use the stat() function but it did'nt suit my need either as it works based on time when file is last modified.
Thanks !!!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.