Android File Delete DeleteFile(File file)

Here you can find the source of DeleteFile(File file)

Description

Delete File

Declaration

public static boolean DeleteFile(File file) 

Method Source Code

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

public class Main {

    public static boolean DeleteFile(File file) {
        if (file.isFile()) {

            return file.delete();
        }//from   w  w  w. j  ava  2 s  . c  o  m
        if (file.isDirectory()) {
            File[] childFile = file.listFiles();
            if (childFile == null || childFile.length == 0) {

                return file.delete();
            }
            for (File f : childFile) {
                DeleteFile(f);
            }
            return file.delete();
        }
        return false;
    }
}

Related

  1. deleteFile(File f)
  2. deleteFile(File file)
  3. deleteFile(String filePath)
  4. delete(File file)
  5. deleteFile(String fileName)