SyntaxFix
Write A Post
Hire A Developer
Questions
Since the directory is not empty, file.delete() returns false, always.
I used
file.deleteRecursively()
which is available in Kotlin and would delete the completely directly and return the boolean response just as file.delete() does.