home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 14375 < prev    next >
Encoding:
Internet Message Format  |  1992-08-22  |  1.8 KB

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