
func copyFolders() { let filemgr = fileManager.default filemgr.delegate = self let dirPaths = filemgr.urls(for: .documentDirectory,in: .userDomainMask) let docsURL = dirPaths[0] let folderPath = Bundle.main.resourceURL!.appendingPathComponent("Test").path let docsFolder = docsURL.appendingPathComponent("Test").path copyfiles(pathFromBundle: folderPath,pathDestDocs: docsFolder)}func copyfiles(pathFromBundle : String,pathDestDocs: String) { let fileManagerIs = fileManager.default fileManagerIs.delegate = self do { let fileList = try fileManagerIs.contentsOfDirectory(atPath: pathFromBundle) try? fileManagerIs.copyItem(atPath: pathFromBundle,topath: pathDestDocs) for filename in fileList { try? fileManagerIs.copyItem(atPath: "\(pathFromBundle)/\(filename)",topath: "\(pathDestDocs)/\(filename)") } } catch { print("\nError\n") }} 总结 以上是内存溢出为你收集整理的ios – Swift 3 – 将文件夹从主包复制到文档目录全部内容,希望文章能够帮你解决ios – Swift 3 – 将文件夹从主包复制到文档目录所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)