List of utility methods to do File Path Delete
boolean | deleteRecursive(File path, boolean debug) delete Recursive if (!path.exists()) { return true; boolean ret = true; if (path.isDirectory()) { for (File f : path.listFiles()) { ret = ret && deleteRecursive(f, debug); if (debug) out.println("deleting " + path); return ret && path.delete(); |
void | deleteRecursively(File path) Delete the specified directory/file. if (path.isDirectory()) { for (File child : path.listFiles()) deleteRecursively(child); if (!path.delete()) throw new RuntimeException("Failed to delete this file/directory: " + path.getAbsolutePath()); |
void | deleteRecursively(File path, File parentCanonical) Deletes a file or sub-directory recursively, but does not follow links within the directory structure. if (!path.exists()) return; else if (!path.isDirectory()) { if (!path.delete()) throw new IOException("Could not delete file " + path); } else { File canonical = path.getCanonicalFile(); File realParent = canonical.getParentFile(); ... |
void | deleteSelectedFilesFromDirectory(final String directoryPath, final List delete Selected Files From Directory final File directory = new File(directoryPath); if (directory != null && directory.exists()) { for (final File file : directory.listFiles()) { if (filesList == null || filesList.isEmpty() || !filesList.contains(file.getName())) { file.delete(); |
void | deleteSubfiles(String publishTemppath) delete Subfiles File file = new File(publishTemppath); if (!file.exists() || file.isFile()) return; File[] files = file.listFiles(); for (int i = 0; files != null && i < files.length; i++) { File temp = files[i]; if (temp.isDirectory()) { deleteSubfiles(temp.getAbsolutePath()); ... |
File | deleteTemp(String tempPath) delete Temp File tempFile = new File(tempPath); if (tempFile.exists()) { deleteFile(tempFile); return tempFile; |
void | deleteTempDataFile(String dataFilePath) delete Temp Data File File dataFile = new File(dataFilePath);
dataFile.delete();
|
void | deleteTempFile(String sourceFilePath) DeleteTempFile(String sourceFilePath) method is responsible delete content file File tempfile = new File(sourceFilePath); if (tempfile.exists()) { tempfile.delete(); |
void | deleteTree(final File path) Delete all files recursively within tree. if (path.exists()) { if (path.isDirectory()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteTree(files[i]); } else { files[i].delete(); ... |
boolean | deleteWallpaper(String file_name, Map deletes a wallpaper and all its copies Set<Entry<String, Integer>> entrySet = dimmensions.entrySet(); Iterator<Entry<String, Integer>> entries = entrySet.iterator(); while (entries.hasNext()) { Entry<String, Integer> e = entries.next(); File rez = new File(basepath + File.separator + e.getKey() + File.separator + file_name); if (rez.exists() && !rez.delete()) { rez.deleteOnExit(); return false; ... |