计算文件夹size
-(long)fileSizeForDir:(NSString*)path//计算文件夹下文件的总大小
{
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSArray* array = [fileManager contentsOfDirectoryAtPat h:path error:nil];
for(int i = 0; i<[array count]; i++)
{
NSString *fullPath = [path stringByAppendingPathCom ponent:[array objectAtIndex:i]];
BOOL isDir;
if ( !([fileManager fileExistsAtPath:fullPath isDirectory:&isDir] && isDir) )
{
NSDictionary *fileAttributeDic=[fileManager attributesOfItemAtPath:fullPatherror:nil];
size+= fileAttributeDic.fileSize;
}
else
{
[self fileSizeForDir:fullPath];
}
}
[fileManager release];
return size;
}
http://blog.sina.com.cn/s/blog_60b45f230100yd7n.html
-(long)fileSizeForDir:(NSString*)path//计算文件夹下文件的总大小
{
}