NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];
if (attributes != nil) {
NSNumber *fileSize = [attributes objectForKey:NSFileSize];
NSString *accountName = [attributes objectForKey:NSFileOwnerAccountName];
NSString *createDate = [attributes objectForKey:NSFileCreationDate];
NSDate *modifyDate = [attributes objectForKey:NSFileModificationDate];
//文件大小
if (fileSize) {
NSLog(@"File size: %qi\n", [fileSize unsignedLongLongValue]);
}
//文件创建日期
if (createDate) {
NSLog(@"File creationDate: %@\n", createDate);
//textField.text=NSFileCreationDate;
}
//文件所有者
if (accountName) {
NSLog(@"Owner: %@\n", accountName);
}
//文件修改日期
if (modifyDate) {
NSLog(@"Modification date: %@\n", modifyDate);
}
}