Here you can find the source of deleteDirectory(File path)
static public void deleteDirectory(File path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { static public void deleteDirectory(File path) { if (path != null && path.exists()) { if (path.isDirectory()) { for (File f : path.listFiles()) { deleteDirectory(f);/*from www . j a va 2s. co m*/ } } path.delete(); } } }