List of utility methods to do File Path Delete
boolean | delete(String filePath, boolean recursive) delete File file = new File(filePath); if (!file.exists()) { return true; if (!recursive || !file.isDirectory()) return file.delete(); String[] contents = file.list(); if (contents != null) { ... |
boolean | delete(String path) Attempts to delete the File with the given path. return new File(path).delete(); |
void | delete(String path) delete File f = new File(path); if (!f.exists()) return; if (f.isDirectory()) { if (f.listFiles().length == 0) { f.delete(); } else { File delFile[] = f.listFiles(); ... |
boolean | delete(String path) Delete the file or directory at the supplied path. if (path == null || path.trim().length() == 0) return false; return delete(new File(path)); |
boolean | delete(String path) Method to delete a file or a directory and all it's contents if there are any. boolean rc = true; File file = new File(path); if (!file.exists()) { throw new IOException("Unable to delete " + path + ". Path does not exist."); if (file.isFile()) { if (file.delete()) { return true; ... |
boolean | deleteAll(File path) delete All boolean ok = true; File[] children = path.listFiles(); if (children != null) { for (File child : children) { ok = deleteAll(child); if (!ok) { break; return ok && path.delete(); |
void | deleteAll(File path) delete All if (!path.exists()) return; if (path.isFile()) { path.delete(); return; File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { ... |
void | deleteAll(File path) delete all files and folders under this path if (path.isDirectory()) { for (File f : path.listFiles()) { deleteAll(f); if (path.listFiles().length == 0) { path.delete(); } else { ... |
boolean | deleteAllFile(final File dir) delete All File boolean deleted = false; if (dir.exists()) { File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteAllFile(files[i]); } else { deleted = files[i].delete(); ... |
void | deleteAllFile(String directory) delete all file List<File> fileList = new ArrayList<File>(); File directoryFile = new File(directory); Queue<File> queue = new ConcurrentLinkedQueue<File>(); queue.add(directoryFile); while (!queue.isEmpty()) { File file = queue.poll(); if (file.isDirectory()) { File[] fileArray = file.listFiles(); ... |