I have stored images from the net like this
Documents/imagecache/domain1/original/path/inURI/foo.png
Documents/imagecache/domain2/original/path/inURI/bar.png
Documents/imagecache/...
Documents/imagecache/...
Now I'd like to check the size of imagecache
including all it sub-directories.
Is there a convenient way of doing it — preferable without crawling through all the data manually?
edit
I want to check the size inside an iPhone App. jailbreaking is no option.
Solution
derived from Nikolai's answer
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSFileManager *fileMgr = [NSFileManager defaultManager];
NSString *p = [documentsDirectory stringByAppendingPathComponent:path];
unsigned long long x =0 ;
for (NSString *s in [fileMgr subpathsAtPath:p]) {
NSDictionary *attributes = [fileMgr attributesOfItemAtPath: [p stringByAppendingPathComponent:s] error:NULL];
x+=[attributes fileSize];
}