NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *path = @"/1ct.rtf";
NSDictionary *fileAttributes = [fileManager fileAttributesAtPath:path traverseLink:YES];
NSLog(@"@@");
if (fileAttributes != nil) {
NSNumber *fileSize;
NSString *fileOwner, *creationDate;
NSDate *fileModDate;
//NSString *NSFileCreationDate
//文件大小
if (fileSize = [fileAttributes objectForKey:NSFileSize]) {
NSLog(@"File size: %qi\n", [fileSize unsignedLongLongValue]);
}
//文件创建日期
if (creationDate = [fileAttributes objectForKey:NSFileCreationDate]) {
NSLog(@"File creationDate: %@\n", creationDate);
//textField.text=NSFileCreationDate;
}
//文件所有者
if (fileOwner = [fileAttributes objectForKey:NSFileOwnerAccountName]) {
NSLog(@"Owner: %@\n", fileOwner);
}
//文件修改日期
if (fileModDate = [fileAttributes objectForKey:NSFileModificationDate]) {
NSLog(@"Modification date: %@\n", fileModDate);
}
}
else {
NSLog(@"Path (%@) is invalid.", path);
}