Here you can find the source of deleteFolder(File folder)
public static boolean deleteFolder(File folder)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static boolean deleteFolder(File folder) { return deleteFolderContents(folder) && folder.delete(); }//from www.j a v a 2 s. c o m public static boolean deleteFolderContents(File folder) { File[] files = folder.listFiles(); if (files != null) { for (File file : files) { if (file.isFile()) { if (!file.delete()) { return false; } } else { if (!deleteFolder(file)) { return false; } } } } return true; } }