Here you can find the source of deleteDir(File f)
private static boolean deleteDir(File f)
//package com.java2s; /* The contents of this file are subject to the Mozilla Public License */ import java.io.File; public class Main { private static boolean deleteDir(File f) { if (f.isDirectory()) { boolean res = true; for (File child : f.listFiles()) { res = deleteDir(child) && res; }//w w w . j a v a 2 s.c o m res = f.delete() && res; return res; } else { return f.delete(); } } }