Hi:
I tried to use stat() function to retrive properties of a file, e.g. last accessed time, last modified time etc.
It works on some of the files of one directory, but not all.
Here is the code:
#/usr/local/bin/perl
use strict;
my $directory = "here is the directory";
opendir THISDIR, $directory or die "cannot open the directory: $!";
my @allFiles = readdir THISDIR;
foreach my $file (@allFiles)
{
my @fileAttributes = stat($file);
#here it's supposed to print a numebr related to
#the last modification time. but for some files this attribute is null, some files have the number.
print "fileAttributes=$fileAttributes[8]\n";
}
closedir(THISDIR);
The code is supposed to print a number for each file, which is related to the last midified time. However, that number can be printed for some file, but others are null.
Could anyone give me any advices why that happedned?
Thanks a lot,
George
I tried to use stat() function to retrive properties of a file, e.g. last accessed time, last modified time etc.
It works on some of the files of one directory, but not all.
Here is the code:
#/usr/local/bin/perl
use strict;
my $directory = "here is the directory";
opendir THISDIR, $directory or die "cannot open the directory: $!";
my @allFiles = readdir THISDIR;
foreach my $file (@allFiles)
{
my @fileAttributes = stat($file);
#here it's supposed to print a numebr related to
#the last modification time. but for some files this attribute is null, some files have the number.
print "fileAttributes=$fileAttributes[8]\n";
}
closedir(THISDIR);
The code is supposed to print a number for each file, which is related to the last midified time. However, that number can be printed for some file, but others are null.
Could anyone give me any advices why that happedned?
Thanks a lot,
George