创建文件夹:
NSString *Dir = [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), dirName];
BOOL isDir = NO;
NSFileManager *fileManager = [NSFileManager defaultManager];
BOOL existed = [fileManager fileExistsAtPath:Dir isDirectory:&isDir];
if ( !(isDir == YES && existed == YES) )
{
[fileManager createDirectoryAtPath:imageDir withIntermediateDirectories:YES attributes:nilerror:nil];
}
删除文件夹和文件级内的文件:
NSString *Dir = [NSString stringWithFormat:@"%@/%@", NSHomeDirectory(), dirName];
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager removeItemAtPath:Dir error:nil];