in reply to Listing files
use strict; use warnings; use File::Find; my $dir = 'c:'; my $search_month = 1; my $search_year = 2002; find(\&wanted, $dir); sub wanted { my $content = $_; if(-f $content) { my($month, $year) = get_month_year($content); if(($month eq $search_month) && ($year eq $search_year)) { print "$content was last accessed in $month of $year\n"; } } } sub get_month_year { my $file = shift; my @params = stat $file; my @dparams = localtime($params[9]); my $month = $dparams[4] + 1; my $year = $dparams[5] + 1900; return($month, $year); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Listing files
by oaklander (Acolyte) on Feb 13, 2002 at 12:07 UTC | |
by snapdragon (Monk) on Feb 13, 2002 at 12:36 UTC | |
|
Re: Re: Listing files
by oaklander (Acolyte) on Feb 13, 2002 at 10:48 UTC |