Java tutorial
//package com.java2s; import java.io.File; public class Main { public static boolean deleteFolder(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteFolder(new File(dir, children[i])); if (!success) { return false; } } } return dir.delete(); } }