NSDocumentDirectory remove folder

Swift 5

Also you should check if file exist at path or not and check for error also.

do {
    let fileManager = FileManager.default

    // Check if file exists
    if fileManager.fileExists(atPath: urlfilePath) {
        // Delete file
        try fileManager.removeItem(atPath: urlfilePath)
    } else {
        print("File does not exist")
    }
} catch {
    print("An error took place: \(error)")
}

Yes it will delete folder also.

From the documentation of: - removeItem(at:)

Removes the file or directory at the specified URL.

From the documentation of: - removeItem(atPath:)

Removes the file or directory at the specified path.

Edit: You can call it like this way.

try? FileManager.default.removeItem(at: URL(fileURLWithPath: ziPFolderPath))
//OR
try? FileManager.default.removeItem(atPath: ziPFolderPath)