At 14:37 -0700 1999.08.21, Nicholas G. Thornton wrote: >is there a built in function or module to calculate the length or size of a >file? I've tried using "read" but haven't been able to get it to work right. > >If not how would I go about doing that (finding file length)? It depends on what you want. If you want the size of the data fork, use stat() or -s (see perlfunc.pod). If you want actual size including the resource fork, you can use this: use Mac::Files; my $cat = FSpGetCatInfo($file); my $size = $cat->ioFlLgLen() + $cat->ioFlRLgLen(); # data + resource Bart Lateur has pointed out this is NOT necessarily the size that a file takes on disk; for that, you would need to get the data fork size, round up to the disk sector size, get the resource fork, round up to the disk sector size, and add those together. -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org