Here you can find the source of deleteDirectory(String directory)
public static boolean deleteDirectory(String directory)
//package com.java2s; import java.io.File; public class Main { public static boolean deleteDirectory(String directory) { return deleteDirectory(new File(directory)); }/*from ww w. j a v a 2 s.c o m*/ public static boolean deleteDirectory(File dir) { File[] files = dir.listFiles(); if (files != null) { for (File f : files) { f.delete(); } dir.delete(); } return !dir.exists(); } }