List of utility methods to do Delete Folder
boolean | deleteFolder(String name) delete Folder File file = new File(name); if (file.isDirectory()) { deleteFiles(file); return file.delete(); |
void | deleteFolderContents(File folder) delete Folder Contents File[] files = folder.listFiles(); if (files != null) for (File f : files) { if (f.isDirectory()) { deleteFolderContents(f); f.delete(); } else f.delete(); ... |
boolean | deleteFolderContents(File folder) delete Folder Contents File[] files = folder.listFiles(); if (files != null) { for (File file : files) { if (file.isFile()) { if (!file.delete()) { return false; } else { ... |
void | deleteFolderContents(File folder) delete Folder Contents deleteFolderContents(folder, new ArrayList<String>());
|
void | deleteFolderIfEmpty(File f) delete Folder If Empty if (f.listFiles().length == 0) {
deleteFolder(f);
|
void | deleteFolderRec(File dir) Deletes recursively specified folder or file. if (dir == null || !dir.exists() || !dir.isDirectory()) return; for (File file : dir.listFiles()) if (file.isDirectory()) deleteFolderRec(file); else if (!file.delete()) file.deleteOnExit(); if (!dir.delete()) ... |
int | deleteFolderRecursive(File folder) delete Folder Recursive int count = 0; if (folder == null) return count; if (folder.exists()) { for (File f : folder.listFiles()) { if (f.isDirectory()) { count += deleteFolderRecursive(f); f.setWritable(true, false); ... |
void | deleteFolderRecursively(File file) delete Folder Recursively try { File[] allFiles = file.listFiles(); if (allFiles == null) { file.delete(); return; for (File f : allFiles) { if (f.isDirectory()) ... |
void | deleteFolderRecursively(File folder) delete Folder Recursively if (folder != null && folder.isDirectory() && folder.canWrite()) { File[] listFiles = folder.listFiles(); if (listFiles != null) { for (File f : listFiles) { if (f.isFile()) { f.delete(); } else if (f.isDirectory()) { deleteFolderRecursively(f); ... |