$Bill Luebkert wrote:
David Dick wrote:

how about;

use DirHandle();
use File::Spec();
use strict;
use warnings;

my ($directory) = "C:\\some\\directory";
my ($handle) = new DirHandle($directory);
unless ($handle) {
        die("Failed to open '$directory':$^E");
}
my ($entry, $path);
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks);
while($entry = $handle->read()) {
        $path = File::Spec->catfile($directory, $entry);
# ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($path);
        ($mtime) = (stat($path))[9];
}
unless ($handle->close()) {
        die("Failed to close '$directory':$^E");
}


You've got a little bug in there on the stat - my modification with printout 
added :

use strict;
use warnings;
use DirHandle;
use File::Spec;

my $dir = "C:/tmp";
my $handle = new DirHandle $dir or
  die "new DirHandle '$dir': $! ($^E)";

print "$dir:\n";
while (my $entry = $handle->read) {
        next if $entry =~ /^\.\.?$/;
        my $mtime = (stat "$dir/$entry")[9];
        printf "%-25s %s\n", scalar localtime $mtime, $entry;
}
$handle->close or die "close '$dir': $! ($^E)";

__END__

you're saying the bug was that i didn't print out the mtime?
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to