in reply to Re: using grep on a directory to list files for a single date
in thread using grep on a directory to list files for a single date
any ideas??sub list{ my $path=shift; my $comp=shift; if (! -e $path){die "Error : $path $!\n";} opendir(DIR,$path) or die "Error : $path $!\n"; return sort map { my ($d,$m,$y) = (localtime( (stat "$path/$_")[9] ) )[3..5]; $m+=1; $y+=1900; $m=($m<10)?"0$m":$m; $d=($d<10)?"0$d":$d; my $date = "$d/$m/$y"; if($date eq $comp){"$_\n"}; } grep(!/^(\.+?)$/,readdir(DIR)); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: using grep on a directory to list files for a single date
by ikegami (Patriarch) on Dec 01, 2004 at 15:07 UTC | |
by ikegami (Patriarch) on Dec 01, 2004 at 16:25 UTC | |
|
Re^3: using grep on a directory to list files for a single date
by revdiablo (Prior) on Dec 01, 2004 at 18:25 UTC |