Here you can find the source of delete(String filePath)
public static boolean delete(String filePath)
//package com.java2s; //License from project: Creative Commons License import java.io.File; public class Main { public static boolean delete(String filePath) { return delete(new File(filePath)); }//from w w w. j a va 2 s . c o m public static boolean delete(File file) { if (file.isDirectory()) { File[] files = file.listFiles(); for (File innerFile : files) { delete(innerFile); } } return file.delete(); } }