List of utility methods to do File Delete
void | deleteRecursively(File f) delete Recursively if (f.isDirectory()) { for (String s : f.list()) { deleteRecursively(new File(f, s)); boolean b = f.delete(); if (!b) { throw new IOException("failed to delete " + f); ... |
void | deleteSubfiles(String publishTemppath) delete Subfiles File file = new File(publishTemppath); if (!file.exists() || file.isFile()) return; File[] files = file.listFiles(); for (int i = 0; files != null && i < files.length; i++) { File temp = files[i]; if (temp.isDirectory()) { deleteSubfiles(temp.getAbsolutePath()); ... |
void | deleteTempDir(File dir) Recursively delete specified directory. if (dir.exists()) { for (File f : dir.listFiles()) { if (f.isDirectory()) { deleteTempDir(f); } else { f.delete(); dir.delete(); |
void | deleteTempFile(File tmpFile) Delete a temporary file. if (!tmpFile.exists()) { return; if (!tmpFile.delete()) { logger.warn("Failed to delete temporary file " + tmpFile + "; something is probably holding it open"); |
void | deleteTempFiles() delete Temp Files for (File f : myTempFiles)
f.delete();
|
boolean | delfile(String path) delfile File file = new File(path); file.delete(); return !file.exists(); |
boolean | delfile(String path, String name) delfile File file = new File(path + Dependence.getPathChar() + name); file.delete(); return !file.exists(); |
void | findDeleteClasspathFile(String filename) find Delete Classpath File URL url = FileUtil.class.getClassLoader().getResource(filename); if (url != null) { File file = new File(url.getFile()); file.delete(); |
void | forceDelete(File file) force Delete if (file.isDirectory()) { deleteDirectory(file); } else if (!file.delete()) { String message = "File " + file + " unable to be deleted."; throw new IOException(message); |
void | forceDelete(File file) Deletes a file. if (file.isDirectory()) { deleteDirectory(file); } else { boolean filePresent = file.exists(); if (!file.delete()) { if (!filePresent) { throw new FileNotFoundException("File does not exist: " + file); ... |