Here you can find the source of delete(final File path)
public static void delete(final File path)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void delete(final File path) { final String[] files = path.list(); String parentPath = path.getPath(); for (final String name : files) { final File file = new File(parentPath, name); if (file.isDirectory()) { delete(file);/*w w w . jav a 2 s . c o m*/ } file.delete(); } path.delete(); } }