Getting Free Disk Space
Based on the example at http://iphoneincubator.com/blog/device-information/how-to-obtain-total-and-available-disk-space-on-your-iphone-or-ipod-touch
//*****************************************
//*****************************************
//********** GET FREE DISK SPACE **********
//*****************************************
//*****************************************
-(float)GetFreeDiskSpaceInBytes
{
float totalSpace = 0.0f;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
if (dictionary)
{
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemFreeSize]; //Or NSFileSystemSize for total size
totalSpace = [fileSystemSizeInBytes floatValue];
}
else
{
NSLog(@"Error Obtaining File System Info: Domain = %@, Code = %@", [error domain], [error code]);
}
return totalSpace;
}