1 2 3 4 5 6 7 8 9 10 11
my $dir='/irgendwo/im/dateisystem'; opendir(my $dh, $dir) or die("Error open $dir $!\n"); my @files=grep{-f "$dir/$_"}readdir($dh); closedir($dh); # Schwarzsche Transformation # name -> [mdate,name] -> sort() -> name @files=map{$_->[1]}sort{$a->[0] <=> $b->[0]}map{[-M "$dir/$_",$_]}@files; for my $file (@files) { # mach was mit den sortierten Namen. }