List of utility methods to do Directory Clear
void | cleanDirectory(File directory) clean Directory if (!directory.exists()) { directory.mkdirs(); return; if (!directory.isDirectory()) { String message = directory + " is not a directory"; throw new IllegalArgumentException(message); File[] files = directory.listFiles(); if (files == null) throw new IOException("Failed to list contents of " + directory); IOException exception = null; for (File file : files) try { forceDelete(file); } catch (IOException ioe) { exception = ioe; if (null != exception) throw exception; |
void | cleanDirectory(File directory) Cleans a directory without deleting it. if (!directory.exists()) { throw new IllegalArgumentException(directory + " does not exist"); if (!directory.isDirectory()) { throw new IllegalArgumentException(directory + " is not a directory"); File[] files = directory.listFiles(); if (files == null) { ... |
void | cleanDirectory(File directory) Recursively cleans (removes) all files under the given directory. boolean success; if (directory.isDirectory()) { String[] children = directory.list(); for (int i = 0; i < children.length; i++) { File child = new File(directory, children[i]); if (child.isDirectory()) { success = deleteDirectory(child); } else { ... |
void | cleanDirectory(File directory) clean Directory if (!directory.exists()) { String message = directory + " does not exist"; throw new IllegalArgumentException(message); if (!directory.isDirectory()) { String message = directory + " is not a directory"; throw new IllegalArgumentException(message); File files[] = directory.listFiles(); if (files == null) throw new IOException("Failed to list contents of " + directory); IOException exception = null; for (int i = 0; i < files.length; i++) { File file = files[i]; try { forceDelete(file); } catch (IOException ioe) { exception = ioe; if (null != exception) throw exception; else return; |
void | cleanDirectory(File path) clean Directory if (path.exists()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); } else { if (!files[i].getName().equals("ramdisk")) { files[i].delete(); ... |
void | cleanDirectory(final File directory) Methode which delete all children of directory if (directory.isDirectory()) { File[] children = directory.listFiles(); if (children != null) { for (int i = 0; i < children.length; i++) { if (children[i].isDirectory()) { cleanDirectory(children[i]); children[i].delete(); ... |
void | cleanDirectory(final File directory) Clean a directory without deleting it. if (!directory.exists()) { return; if (!directory.isDirectory()) { return; IOException exception = null; final File[] files = directory.listFiles(); ... |
void | cleanDirectory(IProgressMonitor monitor, File directory) Clean a directory without deleting it. if (!directory.exists()) { String message = directory + " does not exist"; throw new IllegalArgumentException(message); if (!directory.isDirectory()) { String message = directory + " is not a directory"; throw new IllegalArgumentException(message); IOException exception = null; File[] files = directory.listFiles(); for (int i = 0; i < files.length; i++) { if (monitor.isCanceled()) return; File file = files[i]; try { forceDelete(monitor, file); } catch (IOException ioe) { exception = ioe; if (null != exception) { throw exception; |
void | cleanDirectory(IProgressMonitor monitor, File directory, File base, int step) clean Directory if (!directory.exists()) { String message = directory + " does not exist"; throw new IllegalArgumentException(message); if (!directory.isDirectory()) { String message = directory + " is not a directory"; throw new IllegalArgumentException(message); IOException exception = null; boolean isPackage = false; File[] files = directory.listFiles(); for (int i = 0; i < files.length; i++) { File file = files[i]; if (!isPackage && file.isFile()) { isPackage = true; try { forceDelete(monitor, file, base, step); } catch (IOException ioe) { exception = ioe; if (isPackage) { if (monitor != null) { monitor.worked(step); if (null != exception) { throw exception; |
void | cleanDirectory(String dir) clean Directory File directory = new File(dir); if (directory.isDirectory()) { for (File f : directory.listFiles()) { f.delete(); |