• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Calculating volume free space
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calculating volume free space


  • Subject: Calculating volume free space
  • From: email@hidden
  • Date: Sun, 15 Jan 2006 18:53:17 -0500 (EST)
  • Importance: Normal

I would like to calculate the volume free space (a la Finder's Get Info)
but I am not getting the results I expected.  I have code similar to the
following:

  if(-1 == statfs(tmpDir, &buf)) {
    // handle error
  }

  bytesFree = buf.f_bsize * buf.f_bfree;

The value I get for bytesFree is something strange; df shows I have
84226328 available (about 40GB, which checks with Finder)  but the
bytesFree in the above calculation comes out to 438489088 (about 418 MB).
Obviously I am doing something incorrectly here.

Is there another API I should be using besides statfs?  I couldn't find
anything appropriate in NSWorkspace or NSFileManager.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Calculating volume free space
      • From: Will Mason <email@hidden>
    • Re: Calculating volume free space
      • From: glenn andreas <email@hidden>
  • Prev by Date: Re: How to get initial values into dialog via bindings?
  • Next by Date: DND & CoreData just a small blow of hand?
  • Previous by thread: Re: mechanism for "conditional binding" depending on class of selection
  • Next by thread: Re: Calculating volume free space
  • Index(es):
    • Date
    • Thread