Here you can find the source of deleteDirectory(File file)
public static void deleteDirectory(File file)
//package com.java2s; import java.io.File; public class Main { public static void deleteDirectory(File file) { try {/*from ww w. j av a 2 s.c o m*/ File[] files = file.listFiles(); if (files != null) for (int i = 0; i < files.length; i++) { deleteDirectory(files[i]); } } catch (Exception e) { } try { file.delete(); } catch (Exception e) { } } }