List of utility methods to do Directory Delete
boolean | emptyDirectory(File dir) Recursively deletes all the entries of a directory. String[] children = dir.list(); boolean ok = true; if (children != null) { for (int i = 0; i < children.length; ++i) { File child = new File(dir, children[i]); if (child.isDirectory()) { if (!removeFile(child, true)) ok = false; ... |
void | emptyDirectory(File dir) empty Directory if (dir.exists() && dir.isDirectory()) { File[] tmpFiles = dir.listFiles(); if (tmpFiles.length > 0) { for (File f : tmpFiles) { f.delete(); |
void | emptyDirectory(File directory) Delete the content of a directory, but not the directory itself File[] f = directory.listFiles(); if (f != null) { for (int i = 0; i < f.length; i++) { if (f[i].isDirectory()) { emptyDirectory(f[i]); f[i].delete(); |
boolean | emptyDirectory(File directory) empty Directory boolean result = true; File[] entries = directory.listFiles(); for (int i = 0; i < entries.length; i++) { if (!entries[i].delete()) { result = false; return result; ... |
boolean | emptyDirectory(File path) empty Directory if (path.exists()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); } else { if (!files[i].delete()) { return false; ... |
void | emptyDirectory(final File directory) empty Directory for (final File file : directory.listFiles()) { if (file.isDirectory()) { emptyDirectory(file); if (!file.delete()) { throw new IOException("Can't delete " + file); |