Android File Delete deleteFile(String filePath)

Here you can find the source of deleteFile(String filePath)

Description

delete File

Declaration

public static void deleteFile(String filePath) 

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 ww .  j a v  a2s . c  o 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. safelyDeleteFile(File filePath)
  2. safelyDeleteFile(String filePath)
  3. deleteFolderFile(String filePath, boolean deleteThisPath)
  4. deleteFile(File f)
  5. deleteFile(File file)
  6. delete(File file)
  7. deleteFile(String fileName)
  8. DeleteFile(File file)