List of utility methods to do Delete Directory
void | deleteFiles(String directoryName) Deletes the files in the directory, but does not remove the directory. File dir = new File(directoryName); File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { files[i].delete(); |
void | deleteFiles(String fileName) delete Files File oldPath = new File(fileName); if (oldPath.isDirectory()) { File[] files = oldPath.listFiles(); for (File file : files) { file.delete(); } else { oldPath.delete(); ... |
void | deleteFiles(String root, String mask) delete Files deleteFiles(root, mask, false); |
void | deleteFiles(String sDir, String sSearch) delete Files File dir = new File(sDir).getCanonicalFile(); File[] files = dir.listFiles(); for (File f : files) { if (sSearch.equals("*")) { f.delete(); } else { String[] sHold = sSearch.split(","); for (String s : sHold) { ... |
void | deleteFiles(String[] filenames) Clean up - delete unzipped files that have already been included into ZIP File file; if (filenames == null) return; for (int i = 0; i < filenames.length; i++) { file = new File(filenames[i]); if (file.exists()) file.delete(); |
void | deleteFilesAndDir(List delete Files And Dir File dir = files.get(0).getParentFile();
for (File file : files) {
file.delete();
dir.delete();
|
void | deleteFilesAndSubDirs(File dir) delete Files And Sub Dirs if (!dir.canRead()) return; for (File file : dir.listFiles()) { if (file.isFile()) { System.out.println("deleting " + file.getAbsolutePath()); file.delete(); } else { if (file.isDirectory() && (file.listFiles() == null || file.listFiles().length == 0)) { ... |
boolean | deleteFilesFromDirectory(final String dirNameIn, final String filePrefixIn) Deletes all files in the directory but not the directory itself boolean fileNotDeleted = false; String filePrefix = filePrefixIn; if (filePrefix != null) { filePrefix = filePrefix.toUpperCase(); File dir = new File(dirNameIn); if (dir.isDirectory() == false) { throw new IllegalArgumentException("Specified path [" + dirNameIn + "] is not a directory"); ... |
void | deleteFilesInDir(File dir) Recursively deletes all the files of the specified directory. deleteFilesInDir(dir, false); |
void | deleteFilesInDir(File dir) delete Files In Dir validateFile(dir, false, true, false, true); for (File f : Arrays.asList(dir.listFiles())) if (!f.delete()) throw new IOException("Unable to delete: " + f); |