List of utility methods to do File Delete
void | doDelete(File file) do Delete if (!file.delete()) { throw new IOException("Unable to delete: " + file); |
void | doDelete(File path) do Delete if (!path.exists()) return; if (path.isDirectory()) { for (File child : path.listFiles()) { doDelete(child); if (!path.delete()) { ... |
void | doDeleteEmptyDir(String dir) do Delete Empty Dir boolean success = (new File(dir)).delete(); if (success) { System.out.println("Successfully deleted empty directory: " + dir); } else { System.out.println("Failed to delete empty directory: " + dir); |
boolean | doDeleteEmptyParentQuietly(File parent) do Delete Empty Parent Quietly try { if (parent == null) { return true; boolean result = true; File parentFile = parent.getParentFile(); if (parent.list().length == 0) { parent.delete(); ... |
boolean | doDeleteFileOrDir(File fileOrDir) Deletes specified file or directory. if (fileOrDir.isDirectory() && !doEmptyDir(fileOrDir)) { return false; return fileOrDir.delete(); |
boolean | doDeleteQuietly(File file) do Delete Quietly try { boolean result = true; if (file.isDirectory()) { for (File aFile : file.listFiles()) { boolean res = doDeleteQuietly(aFile); if (result) { result = res; file.delete(); return result; } catch (Throwable ignore) { return false; |
void | fileDelete(String fileName) Deletes a file. File file = new File(fileName);
file.delete();
|
boolean | fileDelete(String path) Deletes a file at the specified path location. if (isPathValid(path)) { File file = new File(path); if (fileExist(path)) { return file.delete(); } else { return true; } else ... |
int | fileDelete(String path) file Delete File file = new File(path); if (!file.exists() || file.isDirectory()) return 4; if (file.delete()) { return 0; return 1; |