I have found a problem when I want to delete a folder and its containers.
let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
let downloadDirectory:URL = urls.appendingPathComponent("Download")
let manager = FileManager.default
let pathString = downloadDirectory.absoluteString // file:///Users/...
let path = downloadDirectory.path // /Users/...
then
let directoryContents:[Any]? = try? manager.contentsOfDirectory(atPath: path)
works well, but
let directoryContents:[Any]? = try? manager.contentsOfDirectory(atPath: pathString)
can't find the folder