List of utility methods to do Delete File Recursively
boolean | deleteRecursively(File[] roots) Delete recursively. boolean deleted = true; for (File root : roots) { deleted &= deleteRecursively(root); return deleted; |
boolean | deleteRecursively(final File directory) Delete a directory recursively if (directory == null) { return true; final File[] list = directory.listFiles(); if (list == null) { return true; for (final File file : list) { ... |
void | deleteRecursively(final File directory) delete Recursively final Stack<File> stack = new Stack<>(); final List<File> temp = new LinkedList<>(); stack.push(directory.getAbsoluteFile()); while (!stack.isEmpty()) { final File top = stack.pop(); File[] files = top.listFiles(); if (files != null) { for (final File child : files) { ... |
void | deleteRecursively(final File iRootFile) delete Recursively if (iRootFile.exists()) { if (iRootFile.isDirectory()) { for (File f : iRootFile.listFiles()) { if (f.isFile()) f.delete(); else deleteRecursively(f); iRootFile.delete(); |
boolean | deleteRecursivelyAtLeastOnExit(final File directory) Deletes a directory recursively, falling back to deleteOnExit(). boolean result = true; final File[] list = directory.listFiles(); if (list != null) { for (final File file : list) { if (file.isDirectory()) { if (!deleteRecursivelyAtLeastOnExit(file)) { result = false; continue; if (!file.delete()) { file.deleteOnExit(); result = false; if (!result || !directory.delete()) { directory.deleteOnExit(); result = false; return result; |
boolean | deleteRecursivelyWithoutDeleteRootDirectory(File pFile) delete Recursively Without Delete Root Directory boolean result = true; if (pFile.isDirectory()) { File files[] = pFile.listFiles(); for (int i = 0; i < files.length; i++) { result &= deleteRecursively(files[i]); return result; ... |
boolean | deleteRecusively(File file) Delete the specified file. if (file.isDirectory()) { File[] subfiles = file.listFiles(); int nb = subfiles.length; for (int i = 0; i < nb; i++) { deleteRecusively(subfiles[i]); return file.delete(); ... |