List of utility methods to do Delete Directory
boolean | deleteDirectory(final File directory) delete Directory if (directory == null) { return false; final File[] files = directory.listFiles(); for (int num = files.length, i = 0; i < num; ++i) { if (files[i].isDirectory()) { if (!deleteDirectory(files[i])) { return false; ... |
boolean | deleteDirectory(final File directory) Delete a directory and its content boolean success = true; ; if (directory.exists()) { final File[] files = directory.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { success &= deleteDirectory(files[i]); } else { ... |
void | deleteDirectory(final File directory) Recursively deletes a directory and all its contents if (directory.isDirectory() && directory.exists()) { for (File file : directory.listFiles()) { if (file.isDirectory()) { deleteDirectory(file); } else { if (!file.delete()) { throw new RuntimeException("Failed to delete file: " + file); if (!directory.delete()) { throw new RuntimeException("Failed to delete directory: " + directory); } else { throw new RuntimeException("Unable to delete directory: " + directory + ". It is either not a directory or does not exist."); |
boolean | deleteDirectory(final String dir) delete Directory return deleteDirectory(new File(dir)); |
void | deleteDirectory(final String targetDir) Delete a directory final File file = new File(targetDir); if (file.exists()) { if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { final File files[] = file.listFiles(); for (int i = 0; i < files.length; i++) { final String dir = targetDir + File.separator + files[i].getName(); ... |
void | deleteDirectory(IProgressMonitor monitor, File directory) Recursively delete a directory. if (!directory.exists()) { return; cleanDirectory(monitor, directory); if (!directory.delete()) { String message = "Unable to delete directory " + directory + "."; throw new IOException(message); |
void | deleteDirectory(IProgressMonitor monitor, File directory, File base, int step) Recursively delete a directory. if (!directory.exists()) { return; cleanDirectory(monitor, directory, base, step); if (!directory.delete()) { String message = "Unable to delete directory " + directory + "."; throw new IOException(message); |
boolean | deleteDirectory(String dir) delete Directory return deleteDirectoryRecursively(new File(dir)); |
boolean | deleteDirectory(String directory) delete Directory return deleteDirectory(new File(directory)); |
void | deleteDirectory(String directory) Deletes a directory. File f = new File(directory);
deleteDirectory(f);
|