Here you can find the source of deleteRecursive(File toDelete)
public static void deleteRecursive(File toDelete)
//package com.java2s; //License from project: LGPL import java.io.File; public class Main { public static void deleteRecursive(File toDelete) { if (toDelete.isFile()) { toDelete.delete();/*from w w w .ja v a 2 s.c om*/ } else if (toDelete.isDirectory()) { for (File f : toDelete.listFiles()) { deleteRecursive(f); } } } }