List of utility methods to do Directory Clean
void | cleanDirectory(File currentDir) Clean directory and it's files File[] files = currentDir.listFiles();
for (File file : files) {
file.delete();
currentDir.delete();
|
String | cleanPath(String loc) clean Path if (loc.startsWith("reference:file:")) { loc = loc.substring(15); } else if (loc.startsWith("file:")) { loc = loc.substring(5); } else { return loc; loc = loc.replace("//", "/"); ... |
String | cleanPath(String path) cleanPath static method replaces all path separators with system dependednt value. String str = path.replace('/', File.separatorChar); String final_str = str.replace('\\', File.separatorChar); return final_str; |
String | cleanPaths(String root, String rel, String name) clean Paths String complete = null; if (root != null) { complete = root; if (rel != null) { if (complete != null) complete = complete + File.separator + rel; else ... |
void | clearDir(File dir, boolean clearsubdirs) clear Dir if (!dir.exists()) return; for (File f : dir.listFiles()) { if (f.isDirectory()) { if (clearsubdirs) { clearDir(f, true); f.delete(); } else f.delete(); |
void | clearDir(String dirPath) Deletes all files in the specified directory, recursively. if (DEBUG) { System.out.println("clearDir(" + dirPath + ")"); final File dir = new File(dirPath); final String[] childList = dir.list(); if (childList == null) { return; for (String childName : childList) { final File child = new File(dirPath + "/" + childName); if (child.isDirectory()) { clearDir(child.getAbsolutePath()); final boolean didIt = child.delete(); if (!didIt) { throw new RuntimeException("could not delete " + child.getAbsolutePath()); |