如果“空”是指其中绝对没有任何内容(0 字节),则可以执行以下操作:
NSFileManager *manager = [NSFileManager defaultManager];
if ([manager fileExistsAtPath:path]) {
NSDictionary *attributes = [manager attributesOfItemAtPath:path error:nil];
unsigned long long size = [attributes fileSize];
if (attributes && size == 0) {
// file exists, but is empty.
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1452 次 |
| 最近记录: |