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