Here you can find the source of deleteDirectory(String name)
public static void deleteDirectory(String name)
//package com.java2s; import java.io.File; public class Main { public static void deleteDirectory(String name) { File folder = new File(name); if (folder.exists()) { File[] files = folder.listFiles(); if (files != null) { for (File f : files) { if (f.isDirectory()) { deleteDirectory(f.getAbsolutePath()); } else { f.delete();//ww w . j av a 2s .co m } } } folder.delete(); } } }