快速迭代(快速遍历 )
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];
});
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];
});
相关文章推荐
- PHP 的“魔术常量”
- mysql,REPLACE INTO()
- js+css 灵活层叠 绝对/相对 定位
- angularJS实现textarea记录只能输入规定数量的字符并显示
- JAVA JDBC连接oracle 测试代码
- redis在windows下安装和PHP中使用
- 转换、、、截取
- C/C++复习:指针引出奇数因子
- JavaScript基础
- JavaScript 获取鼠标点击位置坐标
- 关于LinkedList
- 富文本 Htmll类 html标签
- 事件冒泡
- Android studio2.0在app中设置背景图片及添加图片资源
- 自定义USB-HID设备_笔记
- codeGen生成二维码
- 手把手教你最简单的开源项目托管GitHub入门教程
- 【问题解决】找不到或无法加载主类 com.sun.tools.javac.Main
- Java 通过魔数判断上传文件的类型
- 五、oracle 表管理