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