Here you can find the source of deleteTempDirectory(File dir)
static public void deleteTempDirectory(File dir) throws IOException
//package com.java2s; import java.io.*; public class Main { static public void deleteTempDirectory(File dir) throws IOException { deleteDirectoryContents(dir);/*from ww w .ja va2 s . c om*/ boolean success = dir.delete(); if (!success) { throw new IOException(); } } static private void deleteDirectoryContents(File dir) throws IOException { File[] files = dir.listFiles(); for (File file : files) { if (file.isDirectory()) { deleteDirectoryContents(file); } file.delete(); } } }