Here you can find the source of deleteDirectory(File directory)
public static boolean deleteDirectory(File directory)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static boolean deleteDirectory(File directory) { if (directory.isDirectory()) { File[] fileList = directory.listFiles(); if (fileList != null) { for (File file : fileList) { deleteDirectory(file); }/*from w ww.j a va 2 s.c o m*/ } } return directory.delete(); } }