List of utility methods to do File Delete
boolean | deleteDir(File dir) delete Dir if (dir.isDirectory()) { File[] children = dir.listFiles(); for (File child : children) { boolean success = deleteDir(child); if (!success) { return false; return dir.delete(); |
boolean | deleteDir(File spec) Deletes a file or directory. if (spec.isDirectory()) { String[] children = spec.list(); for (int i = 0; i < children.length; i++) { if (!deleteDir(new File(spec, children[i]))) { return false; return spec.delete(); |
void | deleteDirContent(File d) delete Dir Content if (!d.exists()) return; if (!d.isDirectory()) return; File[] children = d.listFiles(); for (File c : children) { if (c.isDirectory()) deleteDirContent(c); ... |
boolean | deleteFile(File f) delete File if (f.exists()) { if (f.isFile()) return f.delete(); else if (f.isDirectory()) { File[] files = f.listFiles(); for (int i = 0; i < files.length; i++) { if (!deleteFile(files[i])) return false; ... |
void | deleteFile(File f) Deletes the file if (!f.exists()) return; if (f.isDirectory()) { File[] fs = f.listFiles(); for (File cf : fs) { deleteFile(cf); f.delete(); |
void | deleteFile(File f) delete File if (!f.exists()) return; boolean deleted = f.delete(); if (!deleted) throw new IllegalStateException("Could not delete file " + f); |
boolean | deleteFile(File file) Convenience method that will call delete() on file and if that fails will call file.deleteOnExit() scheduling the file for deletion upon normal server exit.
boolean result = file.delete(); if (!result) { Log.util.warning(8498, file); file.deleteOnExit(); return result; |
void | deleteFile(File file) delete File if (!file.exists() || !file.isFile()) { return; if (!file.delete()) { throw new IllegalStateException("delete file failed: " + file); |
void | deleteFile(File file) delete File if (file.exists()) { if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File files[] = file.listFiles(); for (int i = 0; i < files.length; i++) { deleteFile(files[i]); file.delete(); } else { System.out.println("????????????" + '\n'); |
void | deleteFile(File file) delete File if (file.exists()) {
file.delete();
|