Android Directory Delete deleteDirectory(File path)

Here you can find the source of deleteDirectory(File path)

Description

delete Directory

Declaration

static public boolean deleteDirectory(File path) 

Method Source Code

//package com.java2s;
import java.io.File;

public class Main {
    static public boolean deleteDirectory(String path) {
        return deleteDirectory(new File(path));
    }//from  ww w. ja  v a 2 s.  c  o m

    static public boolean deleteDirectory(File path) {
        if (path.exists()) {
            File[] files = path.listFiles();
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory()) {
                    deleteDirectory(files[i]);
                } else {
                    files[i].delete();
                }
            }
        }
        return path.delete();
    }
}

Related

  1. deleteDir(String path)
  2. deleteDirectory(File dir)
  3. deleteDirectory(File dir)
  4. deleteDirectory(File directory)
  5. deleteDirectory(File directory)
  6. deleteDirectory(File path)
  7. deleteDirectory(File path)
  8. deleteDirectory(File path)
  9. deleteDirectory(String directory)