Here you can find the source of deleteDirectoryRecursivly(String path)
public static void deleteDirectoryRecursivly(String path) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; public class Main { public static void deleteDirectoryRecursivly(String path) throws IOException { File file = new File(path); deleteDirectoryRecursivly(file); }/* ww w.ja v a2 s. c om*/ public static void deleteDirectoryRecursivly(File dir) throws IOException { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { deleteDirectoryRecursivly(new File(dir, children[i])); } } dir.delete(); } }