Java tutorial
//package com.java2s; import java.io.File; public class Main { public static void deleteDir(File target) { if (target.exists() == false) { return; } if (target.isFile()) { target.delete(); } if (target.isDirectory()) { File[] files = target.listFiles(); for (int i = 0; i < files.length; i++) { deleteDir(files[i]); } target.delete(); } } }