Here you can find the source of delTree(File file)
public static void delTree(File file) throws Exception
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void delTree(File file) throws Exception { if (file.isFile()) { file.delete();// w w w .jav a 2 s . c o m return; } if (file.isDirectory()) { for (File f : file.listFiles()) delTree(f); } file.delete(); } }