Here you can find the source of deleteDir(File f)
private static void deleteDir(File f)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { private static void deleteDir(File f) { File[] subs = f.listFiles(); for (int i = 0; i < subs.length; i++) { File sub = subs[i];//from w w w . ja va2 s.c om if (sub.isDirectory()) { deleteDir(sub); } else { sub.delete(); } } f.delete(); } }