http://qs1969.pair.com?node_id=47785


in reply to File list by date

Use 'sort' with a file test operator ('-M' for modification time, '-A' for access time, et.c.).
The following script this works fine on my linux box; apologies if it doesn't port to Windows ;-}
#!/usr/bin/perl -w use strict; chdir '/winD' or die "Could not change directory: $!"; opendir DIR, '.' or die "Could not open directory: $!"; my @files = readdir DIR; closedir DIR; my @sortedfiles = sort { -M $a <=> -M $b } @files; $, = "\n"; print @sortedfiles;