您的位置:首页 > 其它

快速迭代(快速遍历 )

2016-04-25 14:38 204 查看
dispatch_queue_t queue=dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
NSString * from=@"";
NSString * to =@"";
NSFileManager * magr=[NSFileManager defaultManager];
NSArray * subpaths=[magr subpathsAtPath:from];//获得from路径下的所有文件

//同时便利作用
dispatch_apply(subpaths.count, queue, ^(size_t index) {
NSString * subpath=subpaths[index];
NSString * fromFullpath=[from stringByAppendingPathComponent:subpath];
NSString * toFullpath=[to stringByAppendingPathComponent:subpath];
[magr moveItemAtPath:fromFullpath toPath:toFullpath error:nil];
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: