getting the size of a folder
getting the size of a folder
- Subject: getting the size of a folder
- From: Peter Schols <email@hidden>
- Date: Sun, 3 Feb 2002 16:20:47 +0100
Hi,
I'm looking for the fastest way to get the size of a folder (including
all subfolders). I'm trying to use NSDirectoryEnumerator, but it doesn't
return a correct value:
NSDirectoryEnumerator *direnum = [[NSFileManager defaultManager]
enumeratorAtPath:@"/Users/mac/Pictures"];
NSNumber *folderSize;
NSDictionary *fattrs = [direnum directoryAttributes];
if (folderSize = [fattrs objectForKey:NSFileSize])
NSLog(@"File size: %d\n", [folderSize intValue]);
What am I doing wrong?
Thanks!
Peter