Java tutorial
//package com.java2s; import java.io.File; public class Main { public static boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); for (String aChildren : children) { boolean success = deleteDir(new File(dir, aChildren)); if (!success) { return false; } } } assert dir != null; return dir.delete(); } }