Here you can find the source of deleteDirectory(File path)
public static boolean deleteDirectory(File path)
//package com.java2s; import java.io.File; public class Main { public static boolean deleteDirectory(File path) { if (path.exists()) { File[] files = path.listFiles(); if (files == null) { return true; }//from ww w .j av a2 s.c om for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); } else { files[i].delete(); } } } return (path.delete()); } }