Here you can find the source of deleteFile(String filePath)
public static boolean deleteFile(String filePath)
//package com.java2s; //License from project: LGPL import java.io.File; public class Main { public static boolean deleteFile(String filePath) { boolean isSuc = false; try {//from w w w.j a va 2 s . com //get file address File file = new File(filePath); if (!file.exists()) { file.mkdirs(); } //create file list File[] files = file.listFiles(); //batch delete files for (int i = 0; i < files.length; i++) { files[i].delete(); } isSuc = true; } catch (Exception e) { isSuc = false; e.printStackTrace(); } return isSuc; } }