Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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.

Comment on Win32 dir attributes
Download Code
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"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://414122]
Approved by sgifford
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2014-10-21 06:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (97 votes), past polls