public static void deleteFolder(File folder) { File[] files = folder.listFiles(); if (files != null) { // some JVMs return null for empty dirs for (File f : files) { if (f.isDirectory()) { deleteFolder(f); } else { f.delete(); } } } folder.delete(); }
public static void delete(String path) { deleteFolder(new File(path)); }