Here you can find the source of recursiveDelete(final File path, final boolean deleteParent)
public static void recursiveDelete(final File path, final boolean deleteParent)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static void recursiveDelete(final File path, final boolean deleteParent) { if (!path.exists()) { return; }/* w ww. j a v a 2s .c om*/ for (final File file : path.listFiles()) { if (file.isDirectory()) { recursiveDelete(file, true); } else { file.delete(); } } if (deleteParent) { path.delete(); } } }