I want to delete a folder that has some other files. First, I'll delete all files in the folder, but I just delete the last file, and I cannot delete the folder.
This is my code:
private void deleteFiles(File file) {
if (file.isDirectory()) {
String [] files = file.list();
for (int i= 0 ; i < files.length ; i++) {
deleteFiles(new File(file, files[i]));
}
}
file.delete();
}