Here you can find the source of deleteDirectory(File directory)
public static void deleteDirectory(File directory)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void deleteDirectory(File directory) { if (!directory.exists()) { return; }//ww w . j a va 2 s.c o m if (directory.isFile()) { directory.delete(); return; } for (File file : directory.listFiles()) { if (file.isDirectory()) { deleteDirectory(file); } file.delete(); } } }