in reply to File::find hack
You could do something like (untested):
I'm using `find` because I've never had a need to learn the File::Find syntax.use File::Spec; my %cache; foreach my $file (`find d:\\Teszt -type f`) { my $age = -M $file; my ($vol, $dir, $name) = File::Spec->splitpath($file); if (exists $cache{$vol, $dir}) { next if $age > $cache{$vol,$dir}[1]; } $cache{$vol,$dir} = [$file, $age]; } foreach my $newest_file_in_directory (map {$$_[0]} values %cache) { ... process file ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File::find hack
by nemesdani (Friar) on Feb 25, 2012 at 12:03 UTC | |
by oko1 (Deacon) on Feb 25, 2012 at 14:04 UTC |