Here you can find the source of delete(File file)
public static void delete(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void delete(File file) { delete(file, false);//from w w w . ja va 2 s . c om } public static void delete(File file, boolean verbose) { if (file.isDirectory()) { File[] children = file.listFiles(); for (int i = 0; i < children.length; i++) { delete(children[i], verbose); } } if (verbose) { System.out.println("Deleting: " + file.getAbsolutePath()); } file.delete(); } }