Android File Delete deleteFile(File file)

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

Description

delete File

Declaration

public static void deleteFile(File file) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {
    public static void deleteFile(String filePath) {
        if (filePath != null) {
            File file = new File(filePath);
            deleteFile(file);/*from w  w  w .j av  a 2s.co m*/
        }
    }

    public static void deleteFile(File file) {
        if (file.exists()) {
            if (file.isFile()) {
                file.delete();
            } else {
                File[] files = file.listFiles();
                if (files != null) {
                    for (File f : files) {
                        deleteFile(f);
                    }
                }
                file.delete();
            }
        }
    }
}

Related

  1. renameFile(String strSrc, String strDest, boolean deleteIfExist)
  2. safelyDeleteFile(File filePath)
  3. safelyDeleteFile(String filePath)
  4. deleteFolderFile(String filePath, boolean deleteThisPath)
  5. deleteFile(File f)
  6. deleteFile(String filePath)
  7. delete(File file)
  8. deleteFile(String fileName)
  9. DeleteFile(File file)