Here you can find the source of deleteRecursive(File path)
public static boolean deleteRecursive(File path) throws FileNotFoundException
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.FileNotFoundException; public class Main { public static boolean deleteRecursive(File path) throws FileNotFoundException { if (path.exists()) { boolean ret = true; if (path.isDirectory()) { for (File f : path.listFiles()) { ret = ret && deleteRecursive(f); }/*from ww w . j ava2s . c o m*/ } return ret && path.delete(); } else { return false; } } }