List of utility methods to do Recursive Delete
boolean | recursiveDeleteNoCheck(File f) recursive Delete No Check try { if (f.isDirectory()) { File[] files = f.listFiles(); for (int i = 0; i < files.length; i++) { if (!recursiveDeleteNoCheck(files[i])) { return (false); if (!f.delete()) { return (false); } else { if (!f.delete()) { return (false); } catch (Exception ignore) { return (true); |
boolean | recursiveDeleteNoCheck(File f) recursive Delete No Check try { if (f.isDirectory()) { File[] files = f.listFiles(); for (int i = 0; i < files.length; i++) { if (!recursiveDeleteNoCheck(files[i])) { return (false); if (!f.delete()) { return (false); } else { if (!f.delete()) { return (false); } catch (Exception ignore) { return (true); |
void | recursiveDeleteOnExit(File parent) Recursively delete parent folder on exit of JVM parent.deleteOnExit(); if (parent.isDirectory()) { File[] files = parent.listFiles(); for (int ifile = 0; ifile < files.length; ++ifile) { if (files[ifile].isDirectory()) { recursiveDeleteOnExit(files[ifile]); files[ifile].deleteOnExit(); ... |
void | recursiveDeleteOnExit(File rootDir) Recursively set this directory to be deleted on termination of the JVM (using File#deleteOnExit() ). recursiveDeleteOnExitHelper(rootDir); |
void | recursiveDeleteOnExitHelper(File fileOrDir) recursive Delete On Exit Helper fileOrDir.deleteOnExit(); if (fileOrDir.isDirectory()) { for (File file : fileOrDir.listFiles()) { recursiveDeleteOnExitHelper(file); |
void | recursivelyDelete(File aDirectory) Recursively deletes the given directory and all of its nested contents. if (!aDirectory.isDirectory()) { return; File[] files = aDirectory.listFiles(); if (files != null) { for (File file : files) { if (file.isFile()) { file.delete(); ... |
void | recursivelyDelete(File dir) recursively Delete if (!dir.getPath().equals(dir.getCanonicalPath())) { return; File[] contents = dir.listFiles(); if (contents != null) { for (File d : contents) { if (d.isDirectory()) { recursivelyDelete(d); ... |
void | recursivelyDelete(final File root, final boolean deleteRoot) Recursively deletes the contents of the given directory (and possibly the directory itself). if (root.isDirectory()) { final File[] contents = root.listFiles(); for (final File child : contents) { recursivelyDelete(child, true); if (deleteRoot) { if (!root.delete()) { ... |
void | recursivelyDelete(String loc) recursively Delete recursivelyDelete(new File(loc));
|
void | recursivelyDeleteEmptyDirectories(File fileToDelete) recursively Delete Empty Directories if (fileToDelete.isDirectory()) { for (File subFile : fileToDelete.listFiles()) { recursivelyDeleteEmptyDirectories(subFile); if (fileToDelete.listFiles().length == 0) { fileToDelete.delete(); |