Android Directory Remove Recursive delete(String root)

Here you can find the source of delete(String root)

Description

Delete File or Folder recursively

Parameter

Parameter Description
root a parameter

Declaration

public static Boolean delete(String root) 

Method Source Code

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

public class Main {
    /**/*from www.  j  av  a2s.  c  o m*/
     * Delete File or Folder recursively
     * 
     * @param root
     * @return
     */
    public static Boolean delete(String root) {
        if (root == null) {
            return false;
        }
        File f = new File(root);
        if (f.isDirectory()) {
            for (File tmp : f.listFiles()) {
                delete(tmp.getAbsolutePath());
            }
        }
        return f.delete();
    }
}

Related

  1. deltree(File directory)
  2. deltree(String directory)
  3. recursiveRemoveDir(File directory)
  4. removeDirectories(File file)
  5. removeDirectories(File file, String regex)
  6. DeleteRecursive(File fileOrDirectory)