Here you can find the source of recursiveDelete(File file)
public static void recursiveDelete(File file) throws IOException
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.IOException; public class Main { public static void recursiveDelete(File file) throws IOException { if (file == null) { return; }// w ww. j a v a2 s. c o m File[] files = file.listFiles(); if (files != null) { for (File each : files) { recursiveDelete(each); } } if (!file.delete()) { throw new IOException("Failed to remove " + file); } } }