in reply to Re3: A little help w/ stat() por favor...
in thread A little help w/ stat() por favor...

Thanks again Blake.. Still just giving me 1's. I tried
$size = (stat($files))[7];
because i definetly know the size of the file and it still gave me 1's. I dont get this. I thought this would be something pretty easy for me to figure out.

Replies are listed 'Best First'.
Re5: A little help w/ stat() por favor...
by blakem (Monsignor) on Jan 11, 2002 at 06:55 UTC
    Is $files a relative path? I think stat needs the full path to the file. Try something like this:
    #!/usr/bin/perl -wT use strict; my $dir = "/var/www/html/file"; my @files; opendir (FILE,$dir) || die "'$dir' $!"; @files = grep {-f "$dir/$_"} readdir (FILE); closedir (FILE) || die $!; foreach my $file (sort(@files)) { my $mtime = (stat("$dir/$file"))[9]; print "$mtime => $file\n"; };

    -Blake