Here you can find the source of deleteDirectory(String path)
static public boolean deleteDirectory(String path)
//package com.java2s; import java.io.File; public class Main { static public boolean deleteDirectory(String path) { return deleteDirectory(new File(path)); }/*from w w w .ja v a 2 s . co m*/ 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 { files[i].delete(); } } } return path.delete(); } }