-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
lorid
Sent: Wednesday, July 20, 2005 3:34 PM
To: perl-win32-users
Subject: help with getting file stats
snip of loris code:
( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime,
$mtime, $ctime, $blksize, $blocks ) = stat($file);
print "\n $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
$atime,Mtime: $mtime,\n Ctime:$ctime,\n $blksize, $blocks\n";
$file_ctr++;
}
}
Darrell Gammill wrote:
Have you tried stat ("$dir/$file")? If you just stat ($file), $file
would have to be the full path or a file in the current directory. Do
you have a sample output you could share?
-Dgg
-------------------------------
loris reply:
yes I did try stat ("$dir/$file") it would not work , and I tried many
variation
here is what I finally got to work:
print "Opening $dir \n";
opendir DH, $dir or die "Can't open the current dir $!\n";
while(my $file = readdir(DH)){
if(-d "$dir/$file"){
print "\n Dir: $file \n";
my $pic_year = substr($file,0,4);
my $pic_month = substr($file,4,2);
print "Year: $pic_year,Month: $pic_month\n";
$dir_ctr++;
}
elsif(-e "$dir/$file"){
print "\n File: $dir/$file ";
#this wont work for me
#my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,$atime,
$mtime, $ctime, $blksize, $blocks) = stat("$dir/$file");
#print "Ctime:$ctime ,Mtime: $mtime\n";
my $now = ctime();
print "\n Nowtime: $now\n";
#this works
my $file_moddate = ctime(stat("$dir/$file")->mtime);
my $file_create_date = ctime(stat("$dir/$file")->ctime);
print "\nfile create date: $file_create_date, file mod date:
$file_moddate";
$file_ctr++;
}
}
closedir DH;
------------------
note : my verion of perl is v5.005_02
I will try the other code on another machine with newer perl v. and see
if that helps...
Thanks for all replies....
Lori
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs