List of utility methods to do Directory Delete
void | deleteContents(String directory) delete all files (recursively) in a directory. File f = new File(directory); if (!f.exists()) { return; if (!f.isDirectory()) { throw new IOException(directory + " is not a vaid directory"); for (String s : f.list()) { ... |
void | deleteDir(File pDirectory) delete Dir if (pDirectory.exists()) { if (pDirectory.isDirectory()) { for (File lFile : pDirectory.listFiles()) { if (!lFile.equals(pDirectory.getParentFile())) { deleteDir(lFile); pDirectory.delete(); |
boolean | deleteDir(String path) Deletes a file or directory. return deleteDir(new File(path)); |
boolean | deleteDirectory(File dir) Deletes the directory and all of its subdirectories and files. if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDirectory(new File(dir, children[i])); if (!success) { return false; return dir.delete(); |
void | deleteDirectory(File dir) delete Directory if (!dir.exists()) return; File[] subs = dir.listFiles(); if (subs != null) { for (File f : dir.listFiles()) { if (f.isFile()) { if (!f.delete()) { throw new IllegalStateException( ... |
void | deleteDirectory(File directory) delete Directory if (!directory.exists()) { return; cleanDirectory(directory); if (!directory.delete()) { String message = "Directory " + directory + " unable to be deleted."; throw new IOException(message); ... |
void | deleteDirectory(File directory) Deletes a directory recursively. if (!directory.exists()) { return; cleanDirectory(directory); if (!directory.delete()) { String message = "Unable to delete directory " + directory + "."; throw new IOException(message); ... |
boolean | deleteDirectory(File path) delete Directory if (path.exists()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); } else { files[i].delete(); return path.delete(); |
boolean | deleteDirectory(File path) delete Directory if (path.exists()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); } else { files[i].delete(); return (path.delete()); |
void | deleteDirectory(File path) Convenience function to delete a directory. if (!path.exists()) return; for (File file : path.listFiles()) { if (file.isDirectory()) deleteDirectory(file); else if (!file.delete()) { throw new IOException(String.format( "Unable to delete file '%s'", file)); ... |