Here you can find the source of deleteTestDirectory(File testDir)
public static void deleteTestDirectory(File testDir)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void deleteTestDirectory(File testDir) { delete(testDir);//from w ww.j a v a2 s . co m testDir.getParentFile().delete(); // Delete if empty } public static void delete(File f) { if (f.isDirectory()) for (File child : f.listFiles()) delete(child); f.delete(); } }