List of utility methods to do Delete Directory
boolean | deleteDirectory(File dir) Deletes a directory and all of its contents. boolean retval = true; File[] currList; Stack<File> stack = new Stack<File>(); stack.push(dir); while (!stack.isEmpty()) { if (stack.lastElement().isDirectory()) { currList = stack.lastElement().listFiles(); if (currList.length > 0) { ... |
void | deleteDirectory(File dir) delete Directory if (dir.isDirectory()) { for (File f : dir.listFiles()) { if (f.isDirectory()) deleteDirectory(f); else f.delete(); dir.delete(); ... |
void | deleteDirectory(File dir) delete Directory deleteDirectory(dir, false); |
boolean | deleteDirectory(File dir) delete Directory if (dir != null && dir.exists()) { File[] a = dir.listFiles(); for (int i = 0; a != null && i < a.length; i++) { if (a[i].isDirectory()) { deleteDirectory(a[i]); } else { a[i].delete(); return dir.delete(); return true; |
void | deleteDirectory(File dir) Deletes a directory with all its files and subdirectories. if (!dir.exists()) { return; if (!dir.isDirectory()) { throw new IOException("File is not a directory: " + dir.getAbsolutePath()); File[] fileArr = dir.listFiles(); if (fileArr != null) { ... |
boolean | deleteDirectory(File dir) Deletes dir and all files and subdirectories under dir. return deleteDirectory(dir, null);
|
boolean | deleteDirectory(File dir, boolean isInitialDelete) delete Directory if (dir.isDirectory()) { if (dir.exists()) { for (File child : dir.listFiles()) { try { deleteDirectory(child, isInitialDelete); } catch (Exception e) { if (isInitialDelete) continue; ... |
boolean | deleteDirectory(File dir, boolean isInitialDelete) Utility method for delete directory if (dir.isDirectory()) { if (dir.exists()) { for (File child : dir.listFiles()) { try { deleteDirectory(child, isInitialDelete); } catch (Exception e) { if (isInitialDelete) { continue; ... |
void | deleteDirectory(File dir, boolean recursive) deletes all files in a director if (!dir.isDirectory()) throw new IllegalArgumentException("directory expected"); File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory() && recursive) deleteDirectory(files[i], true); files[i].delete(); |
boolean | deleteDirectory(File dir, Map Recursively deletes a directory if (dir == null || !dir.exists()) { return true; File[] files = dir.listFiles(); boolean deletedAll = true; for (int i = 0; i < files.length; i++) { if (preserve != null) { if (preserve.containsKey(normalizeFileName(files[i]))) { ... |