NSString *strPath =[[NSBundle mainBundle] pathForResource:@"lomo.jpg" ofType:nil];
NSLog(@"path:%@", strPath);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *path = strPath;//@"/tmp/List";
NSError *error = nil;
NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:path error:&error];
if (fileAttributes != nil) {
NSNumber *fileSize = [fileAttributes objectForKey:NSFileSize];
NSString *fileOwner = [fileAttributes objectForKey:NSFileOwnerAccountName];
NSDate *fileModDate = [fileAttributes objectForKey:NSFileModificationDate];
NSDate *fileCreateDate = [fileAttributes objectForKey:NSFileCreationDate];
if (fileSize) {
NSLog(@"File size: %qi\n", [fileSize unsignedLongLongValue]);
}
if (fileOwner) {
NSLog(@"Owner: %@\n", fileOwner);
}
if (fileModDate) {
NSLog(@"Modification date: %@\n", fileModDate);
}
if (fileCreateDate) {
NSLog(@"create date:%@\n", fileModDate);
}
}
else {
NSLog(@"Path (%@) is invalid.", path);
}