博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
iOS 文件属性
阅读量:4019 次
发布时间:2019-05-24

本文共 959 字,大约阅读时间需要 3 分钟。

    NSString *strPath =[[NSBundle mainBundle] pathForResource:@"test.plist" 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);

    }

转载地址:http://wwwbi.baihongyu.com/

你可能感兴趣的文章
剑指offer算法题分析与整理(一)
查看>>
剑指offer算法题分析与整理(三)
查看>>
部分笔试算法题整理
查看>>
Ubuntu 13.10使用fcitx输入法
查看>>
pidgin-lwqq 安装
查看>>
mint/ubuntu安装搜狗输入法
查看>>
C++动态申请数组和参数传递问题
查看>>
opencv学习——在MFC中读取和显示图像
查看>>
retext出现Could not parse file contents, check if you have the necessary module installed解决方案
查看>>
pyQt不同窗体间的值传递(一)——对话框关闭时返回值给主窗口
查看>>
linux mint下使用外部SMTP(如网易yeah.net)发邮件
查看>>
北京联通华为光猫HG8346R破解改桥接
查看>>
python使用win32*模块模拟人工操作——城通网盘下载器(一)
查看>>
python append 与浅拷贝
查看>>
Matlab与CUDA C的混合编程配置出现的问题及解决方案
查看>>
2017阿里内推笔试题--算法工程师(运筹优化)
查看>>
python自动化工具之pywinauto(零)
查看>>
python自动化工具之pywinauto(四)——批量转换exe视频
查看>>
python一句话之利用文件对话框获取文件路径
查看>>
PaperDownloader——文献命名6起来
查看>>