In my iPhone application, I use the following code to find the file size. Despite the fact that the file exists, I see zero for size. Can someone help me? Thanks in advance.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *URL = [documentsDirectory stringByAppendingPathComponent:@"XML/Extras/Approval.xml"]; NSLog(@"URL:%@",URL); NSError *attributesError = nil; NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:URL error:&attributesError]; int fileSize = [fileAttributes fileSize];
ios objective-c cocoa-touch filesize nsfilemanager
Kiran Apr 21 '11 at 12:08 2011-04-21 12:08
source share