in reply to Age of directories again with a specified directory
use strict; use warnings; use File::Spec::Functions qw( catfile ); my $dir = 'F:\\test'; opendir(my $dh, $dir) or die("Can't open directory \"$dir\": $!\n"); my @dirs; while (defined(my $fn = readdir($dh))) { next if $fn eq '.' || $fn eq '..'; my $qfn = catfile($dir, $fn); if (-d $qfn && -M $qfn > 10) { push @dirs, $qfn; } } foreach (@dirs) { print("$_\n"); }
For future reference, wrap your code in <c>...</c> when posting on Perl Monks. That'll handle line breaks and encoding characters that need encoding (like <, [ and &).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Age of directories again with a specified directory
by dilip_val (Acolyte) on Nov 07, 2007 at 22:08 UTC | |
by ikegami (Patriarch) on Nov 08, 2007 at 01:05 UTC |