Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2016-10-29 00:00 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (387 votes). Check out past polls.