Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Win32 dir attributes

by state-o-dis-array (Hermit)
on Dec 11, 2004 at 17:06 UTC ( #414122=perlquestion: print w/replies, xml ) Need Help??
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);
    my @stat = stat(join("\\", $navigate,$subdir);
    having eyes but never seeing...perhaps some day I will proudly declare "I am a programmer"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://414122]
Approved by sgifford
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2017-07-26 04:16 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (383 votes). Check out past polls.