Here you can find the source of delAll(String path)
public static void delAll(String path) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void delAll(String path) throws Exception { File f = new File(path); if (f.isDirectory()) { String[] children = f.list(); for (String folder : children) { String newPath = path + "/" + folder; delAll(newPath);//from ww w . j ava 2 s .c om } } f.delete(); } }