利用第三方框架SDWebImage
-
获知缓存大小
[SDImageCache SharedImageCache].getsize
-
清除缓存
[[SDImageCache SharedImageCache] clearDisk]
利用文件管理
创建文件管理者
[NSFileManager defaultManager]
获取路径
[mgr attributesOfItemAtPath:cachePath error:nil]
遍历caches一个文件夹里面内容 ——直接内容
[mgr contentsOfDirectoryAtPath:caches error:nil]
获取caches文件夹及子文件的下面的所有内容路径—-直接和间接的都有
[mgr subpathAtPath:caches];
判断是否为文件
[mgr fileExistsAtPath:fullpath isDirectory:&dir];
删除文件
[mgr removeItemAtPath:caches error:nil];