I have some files located at my document folder. I am saving the files like "data_20201223163209.pdf", "data_20201223171831.pdf", "data_20201222171831.pdf", "data_20201221171831.pdf" etc. Now I want to replace "data" with other strings like "newdata". So my files should be "newdata_20201223163209.pdf", "newdata_20201223171831.pdf", "newdata_20201222171831.pdf", "newdata_20201221171831.pdf"
My code:
do {
let path = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let documentDirectory = URL(fileURLWithPath: path)
let originPath = documentDirectory.appendingPathComponent("data")
let destinationPath = documentDirectory.appendingPathComponent("newdata")
try FileManager.default.moveItem(at: originPath, to: destinationPath)
} catch {
print(error)
}
Please help me resolve this issue
NSDocumenttag for?