perlesrh has asked for the wisdom of the Perl Monks concerning the following question:

I need to print files by order of the timestamp in a directory on a remote Windows server. I have the code to print files by order of the file names. But I do not know how to change it to print files by order of the timestamp. I am using Net::SFTP::Foreign module. The current code is as below. The "ordered => 1" option is to print by file name. What is the option to print by the timestamp? I really appreciate if anyone can help.

CODE $sftp->ls('Win_Directory', ordered => 1, wanted => sub { if ( $_1->{longname} =~ /^d/ ) { $dircount++; } else { print "$_1->{longname} \n"; } } ) /CODE
  • Comment on How to print files by order of the timestamp?

Replies are listed 'Best First'.
Re: How to print files by order of the timestamp?
by GrandFather (Saint) on Mar 28, 2012 at 08:51 UTC

      Thank you so much for your responses on "How to print files by order of the timestamp?" What you suggested works well. Thanks again.