Delete Directory 2
import java.io.File; class DirectoryUtils { public static void deleteDirectory(File directory) { if (!directory.isDirectory()) return; File[] content = directory.listFiles(); for (int f = 0; f < content.length; f++) { File file = content[f]; if (file.isDirectory()) deleteDirectory(file); else file.delete(); } directory.delete(); } }