Here you can find the source of deleteDirectoryRecursivly(File directory)
public static boolean deleteDirectoryRecursivly(File directory)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static boolean deleteDirectoryRecursivly(File directory) { String[] list = directory.list(); if (list != null) { for (String entryName : list) { File entry = new File(directory, entryName); if (entry.isDirectory()) { if (!deleteDirectoryRecursivly(entry)) { return false; }/*from ww w .j av a 2s .c o m*/ } else { if (!entry.delete()) { return false; } } } } if (!directory.delete()) { return false; } return true; } }