Android Directory Delete deleteDirectory(String path)

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

Description

delete Directory

Declaration

static public boolean deleteDirectory(String 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   w  w w .ja  v a  2 s  .  co  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. deleteDirectory(File path)
  2. deleteDirectory(File path)
  3. deleteDirectory(File path)
  4. deleteDirectory(File path)
  5. deleteDirectory(String directory)
  6. deleteDirectory(String path)
  7. deleteDirectory(final File directory)
  8. deleteFiles(String directory)
  9. deleteFiles(String directory, String dontDelete)