• 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
Problems getting free disk space
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems getting free disk space


  • Subject: Problems getting free disk space
  • From: Jeff Holland <email@hidden>
  • Date: Wed, 4 Sep 2002 18:38:19 -0700

Hello,

Has anyone else had any problems with the values returned from NSFileManager's fileSystemAttributesAtPath? In my method that checks for sufficient disk space (in abbreviated form below), the values returned for NSFileSystemFreeSize seem incorrect. ('path1' is on an external firewire hard drive, 'path2' is my Desktop folder.) My firewire drive certainly has more free space than my internal drive, but NSFileSystemFreeSize reports the opposite. The same thing happens when I try NSFileSystemSize. However, NSFileSystemNodes and NSFileSystemFreeNodes seem to show more correct results.

Any idea what's going on here? Is this a bug? Could it be due to a potential problem with my filesystem?

Any help would be appreciated.

Thanks,
-jeff


- (BOOL)checkAvailableDiskSpace
{
NSFileManager *manager = [NSFileManager defaultManager];

NSDictionary *fsSrcAttrs = [manager fileSystemAttributesAtPath:[self path1]];
NSDictionary *fsDestAttrs = [manager fileSystemAttributesAtPath:[self path2]];

unsigned int srcSize = [[fsSrcAttrs objectForKey:NSFileSystemFreeSize] unsignedIntValue];
unsigned int destSize = [[fsDestAttrs objectForKey:NSFileSystemFreeSize] unsignedIntValue];

NSLog(@"%@ - %u", [self path1], srcSize);
NSLog(@"%@ - %u", [self path2], destSize);

return (destSize > srcSize) ? YES : NO;
}

--
Either war is obsolete or men are.
- Buckminster Fuller
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: if statements vs. switch
  • Next by Date: Re: ftp mounting
  • Previous by thread: Re: if statements vs. switch
  • Next by thread: How do I get buttons in IB that show the last button pushed by having a highlighted border?
  • Index(es):
    • Date
    • Thread