获取文件属性

文件操作 / 基本操作

NSDictionary *attrs =
    [[NSFileManager defaultManager]
        attributesOfItemAtPath:@"file.txt"
        error:nil];

//文件大小
NSNumber *fileSize = attrs[NSFileSize];

//修改日期
NSDate *modified =
    attrs[NSFileModificationDate];

//创建日期
NSDate *created = attrs[NSFileCreationDate];