Here you can find the source of deleteDirectory(File f)
public static void deleteDirectory(File f) throws IOException
//package com.java2s; import java.io.*; public class Main { public static void deleteDirectory(File f) throws IOException { if (f.isDirectory()) { for (File c : f.listFiles()) { deleteDirectory(c);/*from w w w.j a va 2 s. c o m*/ } } if (!f.delete()) throw new FileNotFoundException("Failed to delete file: " + f); } }