Android Utililty Methods Directory Delete

List of utility methods to do Directory Delete

Description

The list of methods to do Directory Delete are organized into topic(s).

Method

booleandeleteDirectory(File path)
delete Directory
if (path.exists()) {
    File[] files = path.listFiles();
    if (files == null) {
        return true;
    for (int i = 0; i < files.length; i++) {
        if (files[i].isDirectory()) {
            deleteDirectory(files[i]);
...
voiddeleteDir(File dir)
delete Dir
if (dir != null && dir.isDirectory()) {
    String[] children = dir.list();
    for (int i = 0; i < children.length; i++) {
        deleteDir(new File(dir, children[i]));
dir.delete();
voiddeleteDir(File f)
delete Dir
try {
    if (f.isDirectory()) {
        for (File c : f.listFiles()) {
            deleteDir(c);
    f.delete();
} catch (Exception e) {
...