attributesOfItemAtPath获取文件的大小、文件的内容等属性

- (NSDictionary *)attributesOfItemAtPath:(NSString *)path error:(NSError **)error NS_AVAILABLE(10_5, 2_0);



 NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:@"/Users/hechong/Desktop/NewZxing.zip"
                                                                                error:nil];
    NSLog(@"attributes:%@",attributes);//获取文件的属性



attributes:{
    NSFileCreationDate = "2014-10-24 16:32:51 +0000";
    NSFileExtendedAttributes =     {
        "com.apple.quarantine" = <30303032 3b353436 64343431 323b5361 66617269 3b324442 31303037 422d4530 33432d34 3633432d 42423442 2d444638 41383544 31363437 31>;
    };
    NSFileExtensionHidden = 0;
    NSFileGroupOwnerAccountID = 20;
    NSFileGroupOwnerAccountName = staff;
    NSFileModificationDate = "2014-10-24 16:32:51 +0000";
    NSFileOwnerAccountID = 501;
    NSFilePosixPermissions = 420;
    NSFileReferenceCount = 1;
    NSFileSize = 1093489;
    NSFileSystemFileNumber = 10352334;
    NSFileSystemNumber = 16777218;
    NSFileType = NSFileTypeRegular;
}

你可能感兴趣的:(iOS,开发)