List of utility methods to do File Path Delete
boolean | deleteDirRecursive(String dirPath) delete Dir Recursive File dir = new File(dirPath); if (dir.isDirectory()) { File[] children = dir.listFiles(); for (int i = 0; i < children.length; i++) { boolean success = deleteDirRecursive(children[i].getAbsolutePath()); if (!success) { return false; return dir.delete(); |
boolean | deleteDirRecursive(String path) delete Dir Recursive return deleteDirRecursive(new File(path)); |
void | deleteDirs(File path) delete Dirs File[] files = null; if (path.isDirectory()) { path.delete(); files = path.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { deleteDirs(files[i]); path.delete(); |
void | deleteDirs(String pathname) delete Dirs if (pathname == null || pathname.isEmpty()) { return; File path = new File(pathname); deleteDirs(path); |
boolean | deleteDirWithContent(final String path) delete Dir With Content final File dir = new File(path); return deleteDirWithContent(dir); |
void | deleteEmptDir(String Path, String username) This Method is responsible for deleting the author dir in which permission given when it empty String pathdir = Path + "/" + username; File fdir = new File(pathdir); Vector y = new Vector(); String ContentList[] = fdir.list(); for (int j = 0; j < ContentList.length; j++) { y.add(ContentList[j]); if (y.size() == 0) ... |
boolean | deleteEmptyDir(File dstPath) deletes Empty directories Boolean result = false; if (dstPath.exists()) { try { delete(dstPath); } catch (IOException e) { e.printStackTrace(); return result; |
void | deleteEmptyParents(final File path) Delete path and any empty parent directories. deleteEmptyParents(path, null); |
boolean | deleteFile(File path) Delete a file or directory if (!path.exists()) return true; if (path.isDirectory()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteFile(files[i]); } else { ... |
boolean | deleteFile(File path) This function will recursively delete directories and files. if (path.exists()) { if (path.isDirectory()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { if (!deleteFile(files[i])) { try { Thread.sleep(300); ... |