Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static boolean deleteRecursive(File fileOrDirectory) { if (fileOrDirectory.isDirectory()) { for (File child : fileOrDirectory.listFiles()) { deleteRecursive(child); } } return fileOrDirectory.delete() || !fileOrDirectory.exists(); } }