How to list all the files in the document directory?
Solution:
The below code is used for print the document directory files that are stored based on the app.
The below code is used for print the document directory files that are stored based on the app.
let fileManager = FileManager.default
let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory
let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask
let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
guard let dirPath = paths.first else {
return
}
print(dirpath)
Comments
Post a Comment