利用第三方架構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];