List of utility methods to do File Path Delete
void | deleteFile(String path) Delete file deleteFile(new File(path));
|
void | deleteFile(String path) Recursive deletion engine, traverses through all sub-directories, attempting to delete every file and directory it comes across. if (path == null) throw new IOException("Input file path is null"); deleteFile(new File(path)); |
void | deleteFile(String path) delete File File file = new File(path); if (!file.exists()) { return; if (!file.isDirectory()) { if (file.isFile()) { file.delete(); return; String[] tempList = file.list(); String childFilePath = null; for (int i = 0; i < tempList.length; i++) { if (path.endsWith(File.separator)) { childFilePath = path + tempList[i]; } else { childFilePath = path + File.separator + tempList[i]; File temp = new File(childFilePath); if (temp.isFile()) { temp.delete(); } else if (temp.isDirectory()) { deleteFile(childFilePath); file.delete(); |
boolean | deleteFile(String path) Delete file according to a path. File file = new File(path); return deleteFile(file); |
void | deleteFile(String path) delete File try { File file = new File(path); if (file.delete()) { System.out.println(file.getName() + " is deleted!"); } else { System.out.println("Delete operation is failed."); } catch (Exception e) { ... |
void | deleteFile(String path) delete file File file = new File(path);
file.deleteOnExit();
|
void | deleteFile(String path) Utility method to delete a file from one location File f = null; f = new File(path); if (f.exists()) { f.delete(); |
int | deleteFile(String path) deleteFile int res = 0; File temp = new File(path); if (temp.exists() && temp.delete()) { res = 1; return res; |
void | deleteFile(String path) Convenience function to delete a file. if (!new File(path).delete()) throw new IOException(String.format("Unable to delete file '%s'", path)); |
boolean | deleteFile(String path) Delete file. File file = new File(path); if (file.isDirectory()) { for (File subfile : file.listFiles()) { deleteFile(subfile.getAbsolutePath()); file.delete(); return true; ... |