[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Directory Size



At 10.44 6/25/97, Strider wrote:
>I know this isn't ENTIRELY a MACperl question, but it could also
>(conceivably) be different in UNIX. 'Nuff said.
>
>How does one find the size of a directory? I can't seem to find the
>function/command for it, and I'm really at a loss.

How do you mean "size"?  Do you mean number of items in a directory?  Or
the total size of the files in a directory?

I don't think there is a neat way to find the latter; I think you would
have to iterate through the directory structure and go file by file.  As to
the former:

#!perl
$dir="PowerPudgeII:";
opendir(D,$dir) || die $!;
while(readdir(D)){$x++}
close(D);
print $x;
__END__

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch