Android Directory Delete deleteDirectory(File path)

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

Description

delete Directory

Declaration

public static boolean deleteDirectory(File path) 

Method Source Code

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

public class Main {
    public static boolean deleteDirectory(File path) {
        if (path.exists()) {
            File[] files = path.listFiles();
            if (files == null) {
                return true;
            }//from  ww w .j  av a2  s.c  om
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory()) {
                    deleteDirectory(files[i]);
                } else {
                    files[i].delete();
                }
            }
        }
        return (path.delete());
    }
}

Related

  1. deleteFiles(String directory)
  2. deleteFiles(String directory, String dontDelete)
  3. deleteFiles(String directory, String[] dontDelete)
  4. deleteSubdirs(String directory)
  5. removerDiretorio(File dir)
  6. deleteDir(File dir)
  7. deleteDir(File f)