home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!waikato.ac.nz!canterbury.ac.nz!otago.ac.nz!stanger
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Calculating folder sizes [Q]
- Message-ID: <1992Aug23.151140.3309@otago.ac.nz>
- From: stanger@otago.ac.nz (Nigel Stanger)
- Date: 23 Aug 92 15:11:40 +1300
- References: <1992Aug22.061245.5594@news.cs.indiana.edu>
- Organization: University of Otago, Dunedin, New Zealand
- Lines: 31
-
- "John Lacey" <johnl@spinner.cs.indiana.edu> writes:
- > How does one go about calculating the size of a folder?
- >
- > I would be interested in distinguishing between logical and physical
- > sizes. (I would also be interested in which of those the Finder
- > reports.)
-
- You're in luck -- I did this just last weekend :) I wasn't sure
- how to go about it either -- poking around in IM4 I found a some
- fields in one of the parameter blocks (can't remember which
- offhand but I think it was a variant of the CInfoPBRec) called
- ioFlPyLen, ioFlRPyLen, ioFlLgLen, ioFlRLgLen (these names are
- probably slightly wrong, but they're very similar). These are,
- respectively, the physical lengths of the data & resource forks,
- and the logical lengths of same.
-
- I wrote a quick routine which indexed through all files in a
- folder using PBGetCatInfo and added up ioFlPyLen and ioFlRPyLen
- for each file. The answer I got was the same as what Get Info in
- the Finder reported, so I assume the Finder uses a similar
- method (and uses the physical file length).
-
- If you know your way around the low-level File Manager calls you
- should be able to figure it out fairly easily. If you want some
- code, I can go and dig it up.
-
- ----------------------------------------------------------------------
- Nigel Stanger, Internet: stanger@otago.ac.nz
- University of Otago, Phone: +64 3 479-8179
- Dunedin, NEW ZEALAND. Fax: +64 3 479-8311
- If two toucans can can-can, can one toucan can-can too?
-