List of utility methods to do File Path Delete
boolean | deletePath(File path) Delete all files and sub-folders of the specified path, and then the specified path itself. if (path == null) throw new IllegalArgumentException("Null path in FileUtil.deletePath()"); boolean ok = true; try { File[] files = path.listFiles(); for (int i = 0; i < files.length && ok; i++) { if (files[i].exists() && files[i].isDirectory()) ok = deletePath(files[i]); ... |
void | deletePath(final File path) delete Path deletePathAndRetry(path, 3); |
boolean | deletePathRecursive(File path) delete Path Recursive if (path.isDirectory()) { for (File file : path.listFiles()) { if (!deletePathRecursive(file)) return false; return path.delete(); |
boolean | deleteQuietly(Object path) delete Quietly return deleteQuietly(path, false);
|
void | deleteRecursive(File path) Delete a directory and its contents recursively File[] c = path.listFiles(); for (File file : c) { if (file.isDirectory()) { deleteRecursive(file); file.delete(); } else { file.delete(); path.delete(); |
boolean | deleteRecursive(File path) By default File#delete fails for non-empty directories, it works like "rm". if (!path.exists()) { throw new FileNotFoundException(path.getAbsolutePath()); boolean ret = true; if (path.isDirectory()) { for (File f : path.listFiles()) { ret = ret && deleteRecursive(f); return ret && path.delete(); |
boolean | deleteRecursive(File path) delete Recursive if (path.exists()) { boolean ret = true; if (path.isDirectory()) { for (File f : path.listFiles()) { ret = ret && deleteRecursive(f); return ret && path.delete(); ... |
boolean | deleteRecursive(File path) delete Recursive if (path != null && path.exists() && path.isDirectory()) { File[] files = path.listFiles(); for (File f : files) { if (f.isDirectory()) { deleteRecursive(f); } else { f.delete(); if (path != null) { boolean successful = path.delete(); return successful; } else { return false; |
boolean | deleteRecursive(File path) Remove a file/directory. boolean deleteSuccessful = false; if (!exists(path)) { return deleteSuccessful; boolean ret = true; if (path.isDirectory()) { for (File f : path.listFiles()) { ret = ret && deleteRecursive(f); ... |
boolean | deleteRecursive(File path) This function will recursivly delete directories and files. if ((path.exists()) && (path.isDirectory())) { File[] files = path.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteRecursive(files[i]); } else { files[i].delete(); ... |