1 public static void removeFile(File file) { 2 if (file.isDirectory()) { 3 File[] subFiles = file.listFiles(); 4 for (File subFile : subFiles) { 5 removeFile(subFile); 6 } 7 } 8 file.delete(); 9 }