please i need to move the images from folder to another folder in document directory please how can i move these images
the following my code:
let fileManager = NSFileManager.defaultManager()
do {
let document = try fileManager.URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: false)
let getFolders = try fileManager.contentsOfDirectoryAtURL(document, includingPropertiesForKeys: nil, options: .SkipsHiddenFiles)
for folder in getFolders {
if folder.lastPathComponent! == cell.folderNameLabel.text! {
for url in imageUrls {
// ImageUrls is the array of all url which i want to move it to another folder
try fileManager.moveItemAtURL(NSURL(string: url)!, toURL: folder)
}
}
}
}catch {
print(error)
}
i have receive this error (fatal error: unexpectedly found nil while unwrapping an Optional value lldb)
thanks advance