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