in reply to stat only gives info on . & ..
$file contains just the file name, not the path to the file. Fix:
use File::Spec::Functions qw( catfile ); opendir(my $dh, $dirname) or die "can't opendir $dirname: $!\n"; while (defined(my $filename = readdir($dh))) { my $fq_filename = catfile($dirname, $filename); my $mtime = (stat($fq_filename))[9]; print "$filename: $mtime<br>"; } closedir($dh);
I also made the following changes:
I didn't fix the bug where you print out plain text when HTML text is expected.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: stat only gives info on . & ..
by hipnoodle (Novice) on Jan 18, 2007 at 19:13 UTC | |
by ikegami (Patriarch) on Jan 18, 2007 at 19:28 UTC | |
by andyford (Curate) on Jan 18, 2007 at 19:22 UTC | |
by ikegami (Patriarch) on Jan 18, 2007 at 19:34 UTC |