List of utility methods to do Delete Directory
void | deleteDirectory(String directoryName) delete Directory File file = new File(directoryName);
file.delete();
|
void | deleteDirectory(String directoryName) Deletes the directory (and any files) represented by directoryName, if directory doesn't exits does nothing. File directory = new File(directoryName); if (directory.exists()) { if (directory.isDirectory()) { File[] files = directory.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) deleteDirectory(file.getAbsolutePath()); ... |
boolean | deleteDirectory(String dirName) delete Directory return deleteDirectory(new File(dirName)); |
void | deleteDirectory(String dirName) Recursively deletes a directory deleteDirectory(new File(dirName));
|
void | deleteDirectory(String dirname, boolean recursive) INTERNAL: Deletes the directory with the given name, recursively if specified. deleteDirectory(new File(dirname), recursive);
|
void | deleteDirectory(String fileName) delete Directory File directory = new File(fileName); if (!directory.exists()) { } else { try { deleteResursive(directory); } catch (IOException e) { e.printStackTrace(); |
boolean | deleteDirectory(String folder) delete Directory String dir = folder; if (!dir.endsWith(File.separator)) { dir = dir + File.separator; File dirFile = new File(dir); if (!dirFile.exists() || !dirFile.isDirectory()) { return false; boolean flag = true; File[] files = dirFile.listFiles(); for (File file : files) { if (file.isFile()) { flag = deleteFile(file.getAbsolutePath()); if (!flag) { break; else { flag = deleteDirectory(file.getAbsolutePath()); if (!flag) { break; if (!flag) { return false; if (dirFile.delete()) { return true; } else { return false; |
void | deleteDirectory(String name) delete Directory File folder = new File(name); if (folder.exists()) { File[] files = folder.listFiles(); if (files != null) { for (File f : files) { if (f.isDirectory()) { deleteDirectory(f.getAbsolutePath()); } else { ... |
boolean | deleteDirectoryContent(final String strDir) Delete all files and directories in directory but do not delete the directory itself. return ((strDir != null) && (strDir.length() > 0)) ? deleteDirectoryContent(new File(strDir)) : false; |
boolean | deleteDirectoryContents(File directory) delete Directory Contents Preconditions.checkArgument(directory.isDirectory(), "Not a directory: %s", directory); if (isSymbolicLink(directory)) { return false; boolean success = true; for (File file : listFiles(directory)) { success = deleteRecursively(file) && success; return success; |