state-o-dis-array has asked for the wisdom of the Perl Monks concerning the following question:

Good Day All, I am trying to capture the date that a Win32 directory was last modified or created, either one. I have tried using:
foreach my $dir (keys %purgeDirs) { if ($purgeDirs{$dir} == 0){next} my $navigate = join("", $STITSDIR, $dir); opendir (THISDIR, $navigate); my @findDirs = readdir(THISDIR); foreach my $subdir (@findDirs) { my @stat = stat($subdir); } }
This collects data for . and .. but when it gets to a named directory I'm not getting any data. Am I doing something wrong - or can anyone recommend a better approach? One other thing that I'm thinking may be an issue is that the names of the directories I'm concerned with are composed of numbers, and this can't be helped. Much thanks.

Replies are listed 'Best First'.
Re: Win32 dir attributes
by state-o-dis-array (Hermit) on Dec 11, 2004 at 19:31 UTC
    I found the error of my ways. In case anyone else falls in to the same trap... my stat call was running from the current working directory which isn't the same as the directory that I am searching, I achieved the needed result by changing
    my @stat = stat($subdir);
    to
    my @stat = stat(join("\\", $navigate,$subdir);
    having eyes but never seeing...perhaps some day I will proudly declare "I am a programmer"