Here you can find the source of deleteDirectory(File path)
static public boolean deleteDirectory(File path)
//package com.java2s; //License from project: Creative Commons License import java.io.File; public class Main { static public boolean deleteDirectory(File path) { if (path.exists()) { File[] files = path.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); } else { System.out.println("file deleted: " + files[i].getPath()); files[i].delete();// ww w. j a va2s. c om } } } return (path.delete()); } }