Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!usc!apple!apple.com!blob From: blob@apple.com (Brian Bechtel) Newsgroups: comp.sys.mac.programmer Subject: Re: finding amount of free disk space? Message-ID: <4590@internal.Apple.COM> Date: 9 Oct 89 14:15:50 GMT References: <4995@uhccux.uhcc.hawaii.edu> Sender: usenet@Apple.COM Organization: Apple Computer, Inc. Lines: 19 In article <4995@uhccux.uhcc.hawaii.edu> mikem@uhccux.uhcc.hawaii.edu (Mike Morton) writes: > I've got a document open which a user specified with SFGetFile, so all I > have to identify it is a vRefNum and a name. I'd like to find out how > much free space there is on the drive on which the document is stored > (i.e., how much more can I expand the document?). > > It looks like I want to use GetVInfo, which takes a drvNum as a > parameter. If so, how do I map a vRefNum to the drvNum containing it? > If not, what's the right way? Call PBHGetVInfo, passing an ioCompletion of NIL, ioNamePtr of NIL, ioVRefNum of the vRefNum gotten from SFGetFile, and ioVolIndex of 0. You'll get back ioVFrBlk and ioVAlBlkSiz. Multiply those together to get the free bytes on the disk. Or, if you're lazy, pass ioVDrvInfo to your high level call of GetVInfo, and you'll get the multiplication done for you. --Brian Bechtel blob@apple.com "My opinion, not Apple's"