List of utility methods to do File Path Delete
void | deleteAllFiles(Vector filesToDelete) delete All Files for (int i = 0; i < filesToDelete.size(); i++) { ((File) filesToDelete.get(i)).delete(); |
File | deleteAllFilesAux(String input, File swapFolder) Deletes all files in inputFolder backing them up in swapFolder .
File result = null; File file = new File(input); if (file.exists()) if (file.isDirectory()) File originalFolder = file; File swap = null; ... |
void | deleteAllFilesIn(String dir) delete All Files In List<File> files = getAllFilesIn(dir); for (int i = 0; i < files.size(); i++) { files.get(i).delete(); |
boolean | deleteAllFilesInDir(File dir) delete All Files In Dir if (dir.isDirectory()) { boolean result = true; File[] filelist = dir.listFiles(); for (int i = 0; i < filelist.length; i++) { result &= deleteAllFilesInDir(filelist[i]); return result; } else { ... |
boolean | deleteAllFilesInDirectory(String path) deletes entire contents of a folder. File folder = new File(path); if (folder != null && folder.exists() && folder.isDirectory()) { File[] files = folder.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { files[i].delete(); return true; return false; |
void | deleteAllFilesOnlyInDirectory(File startingDir) delete All Files Only In Directory File[] filesToDelete = startingDir.listFiles(); if (filesToDelete != null) { for (int i = 0; i < filesToDelete.length; i++) { if (filesToDelete[i].isFile() && !filesToDelete[i].delete()) System.out.println("Unable to delete file: " + filesToDelete[i].getPath()); |
void | deleteAllFilesRecursively(String directoryName) delete All Files Recursively File dir = new File(directoryName); if (dir.exists()) { deleteAllFilesRecursively(dir); dir.delete(); |
String | deleteAndCreateFolder(String path) delete And Create Folder boolean success_del; File folder = new File(path); success_del = deleteDirectory(folder); if (!success_del) { throw new IOException(); File newFolder = new File(path); if (newFolder.mkdir() == true) { ... |
int | deleteBlankPath(String path) delete Blank Path File f = new File(path); if (!f.canWrite()) { return 1; if (f.list() != null && f.list().length > 0) { return 2; if (f.delete()) { ... |
void | deleteChildDirectoriesExcept(File path, String... directoriesToSkip) delete Child Directories Except if (path.isDirectory()) { for (File child : path.listFiles()) { String name = child.getName(); if (child.isDirectory()) { boolean skip = false; for (String directoryToSkip : directoriesToSkip) { if (name.equalsIgnoreCase(directoryToSkip)) { skip = true; ... |