Here you can find the source of deleteFolder(@Nonnull File file)
public static boolean deleteFolder(@Nonnull File file)
//package com.java2s; //License from project: Open Source License import javax.annotation.Nonnull; import java.io.*; public class Main { public static boolean deleteFolder(@Nonnull File file) { if (file.exists()) { boolean result = true; if (file.isDirectory()) { File[] contents = file.listFiles(); if (contents != null) { for (File f : contents) { result = result && deleteFolder(f); }/*from w w w . j a v a 2s .c o m*/ } } return result && file.delete(); } return false; } }