List of utility methods to do File Path Delete
void | deleteDir(File dir) delete Dir for (File file : dir.listFiles()) { if (!file.delete()) { file.deleteOnExit(); if (!dir.delete()) { dir.deleteOnExit(); |
void | deleteDir(File dir) Delete the given dir and recursively delete all of its children. for (File f : dir.listFiles()) { if (f.isDirectory()) { deleteDir(f); } else { f.delete(); dir.delete(); ... |
boolean | deleteDir(File dir, boolean deleteRoot) delete Dir if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i]), true); if (!success) { return false; if (deleteRoot) { return dir.delete(); return true; |
boolean | deleteDir(File dir, boolean deleteSelf) delete Dir if (dir.isDirectory()) { String[] children = dir.list(); for (String child : children) { boolean success = deleteDir(new File(dir, child), true); if (!success) { return false; if (deleteSelf) { return dir.delete(); } else { return true; |
boolean | deleteDir(File dir, int depth, boolean deleteRootDirectory) Deletes all files and subdirectories under dir. int originalDepth = depth; depth++; if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i]), depth, deleteRootDirectory); if (!success) { return false; ... |
void | deleteDir(File dir, String dirPath) delete Dir if (dir.exists() || dir.isDirectory()) { String[] filesName = dir.list(); for (int i = 0; i < filesName.length; i++) { String path = dirPath + File.separator + filesName[i]; File fileToDelete = new File(path); if (dir.exists() && fileToDelete.isDirectory()) { deleteDir(fileToDelete, path); } else { ... |
boolean | deleteDir(File directory) Deletes the given directory. if (directory.isDirectory()) { File[] children = directory.listFiles(); for (File file : children) { boolean success = deleteDir(file); if (!success) { return false; return directory.delete(); |
void | deleteDir(File directory) delete Dir if (directory.exists()) { String[] children = directory.list(); if (children != null) { for (int i = 0; i < children.length; i++) { deleteDir(new File(directory, children[i])); directory.delete(); |
boolean | deleteDir(File directory) Delete the directory associated with the File as path if empty if (directory == null) { return true; if (!directory.exists()) { return true; if (!directory.isDirectory()) { return false; ... |
boolean | deleteDir(File directory) delete Dir boolean ok = true; File[] children = directory.listFiles(); if (children != null) { for (File file : children) { if (!file.isDirectory()) { ok = ok && file.delete(); } else { ok = ok && deleteDir(file); ... |