djbiv has asked for the wisdom of the Perl Monks concerning the following question:
now I would expect this to return the filename followed by the file size and a value of 1 if it is a directory. which works great on 5.8.0 Active State... However when I run the same code on AIX running 5.005_3 I get "strange" results. the filename, size, and directory indicator are returned for '.' and '..' but every file or directory after that a size and directory indicator are not returned? I check 'perldoc -f -s' on the AIX box and it appears that the file test operators should work the same on 5.005_3 as they do on my windows box....??? can anybody shed some light on this for me?#!/usr/bin/perl -w use strict; my $dir = "."; # relative path within chroot opendir(DIR, $dir) or die "can't open $dir for read: $!\n"; my @file = readdir DIR; closedir(DIR) or die "error closing $dir: $!\n"; foreach my $file (@file) { my $fsize = (-s $file); # get the file size my $isdir = (-d $file); # get the file size if ($fsize > 1 || $isdir =~ 1) { print ":$file:$fsize:$isdir:\n"; ...do more junk.... } else { print ":$file:$fsize:$isdir:\n"; ...do more junk.... } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: file size test on 5.005_3?
by davido (Cardinal) on Oct 15, 2003 at 19:18 UTC | |
|
Re: file size test on 5.005_3?
by Thelonius (Priest) on Oct 15, 2003 at 19:17 UTC | |
|
Re: file size test on 5.005_3?
by Abigail-II (Bishop) on Oct 15, 2003 at 20:13 UTC | |
by djbiv (Scribe) on Oct 15, 2003 at 21:29 UTC | |
by Abigail-II (Bishop) on Oct 15, 2003 at 21:34 UTC |