On Sun, 4 Jul 1999 06:40:10 -0400, Chris Nandor wrote: >At 20.47 -0400 1999.07.03, Todd Richmond wrote: >>How do I find the size of a Mac file, including the resource fork, >>with MacPerl? It appears that the size that stat() returns is the >>size of the file minus the resource fork -> when you zap the resource >>fork on a file, stat() returns the same size as the Finder. In short: you get the length of the data fork. > use Mac::Files; > my $cat = FSpGetCatInfo($file); > my $size = $cat->ioFlLgLen() + $cat->ioFlRLgLen(); Hmmm... That simply adds the length of the data fork and the length of the resource fork. That may be the same result as given by the Finder, but it's also physically useless. Disks (old style) are divided into sectors. Both the data fork and the resource fork use up an integer number of sectors (round up). So, what you should do, is FIRST round up the results returned as the length for each fork, to the next multiple of the sector size, and THEN add those results up. For example, if for some file, both the data fork and the resource fork contain 1 byte, and the sector size is 13k, then both forks use up 13k. The file, as a whole, takes up 26k. If you'd add up both forks' sizes, you get 2, and if you round THAT up, you get 13k. Obviously a wrong value. If you want to calculate the space needed in order to copy a bunch of files, you need to use the sector size of the destination disk. Of course. Is there a Toolbox call, accessible from within MacPerl, that returns the sector size of a disk? Bart. ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org