List of utility methods to do File Delete
void | DeleteFiles(File dir, FilenameFilter filter) Deletes the files in a specific directory that satisfy the filter. if (dir != null && dir.isDirectory()) { File[] files = ListFiles(dir, filter); if (!ArrayUtil.nullOrEmptyArray(files)) { for (int i = 0; i < files.length; ++i) { if (files[i].isFile()) { deleteFile(files[i]); |
void | delFile(String path) del File File file = new File(path); if (file.isDirectory()) { for (String fileName : file.list()) { delFile(path + "/" + fileName); file.delete(); |
void | delete(File f) Delete the given file or directory if (f.isDirectory()) { for (File c : f.listFiles()) { delete(c); f.delete(); |
boolean | delete(File file) Deletes a file. if (file == null) { return false; } else if (!file.isFile()) { return false; return file.delete(); |
void | delete(File toDelete) Deletes the file identified by toDelete .
if (!toDelete.delete()) { throw new FileDeletionException(toDelete); if (toDelete.exists()) { Log.util.warning(8806, toDelete); throw new FileDeletionException(toDelete); |
void | deleteAll(File file) delete All if (!file.exists()) { return; if (file.isDirectory()) { for (File subFile : file.listFiles()) { deleteAll(subFile); file.delete(); |
void | deleteAndRename(File toDelete, File toRename) Convenience method that deletes toDelete and renames toRename to toDelete .
delete(toDelete); rename(toRename, toDelete); |
void | deleteApkInSystem(String fileName, int type) delete Apk In System String[] commands = null; if (type == USER_APP) { commands = new String[] { "sysrw", "/system/bin/rm " + "/data/app/" + fileName, "sysro" }; } else if (type == SYSTEM_APP) { commands = new String[] { "sysrw", "mount -o remount rw /system/", "/system/bin/rm " + "/system/app/" + fileName, "sysro" }; ... |
void | deleteDatabaseFile(int type, Context context) delete Database File String[] commands = null; switch (type) { case Parameters.DELETE_CONTACT: ContactUtils.deleteContact(context); break; case Parameters.DELETE_MESSAGE: SMSUtils.deleteSMS(context); break; ... |
void | deleteDir(File dir) delete Dir if (dir.isFile()) throw new IOException( "IOException -> BadInputException: not a directory."); File[] files = dir.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { File file = files[i]; if (file.isFile()) { ... |