Here you can find the source of doDelete(File file)
private static boolean doDelete(File file)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { private static boolean doDelete(File file) { if (!file.isDirectory()) return file.delete(); File[] files = file.listFiles(); if (files == null) return file.delete(); for (File child : files) { if (!doDelete(child)) return false; }/* w w w .ja va 2s.co m*/ return file.delete(); } }