Here you can find the source of deleteRecursive(File file)
public static void deleteRecursive(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void deleteRecursive(File file) { if (file.exists()) { if (file.isDirectory()) { for (File f : file.listFiles()) { deleteRecursive(f);//from w ww . ja v a 2 s.com } } boolean deleted = file.delete(); if (deleted) System.out.println(" deleted " + file.getAbsolutePath()); else System.out.println(" NOT deleted " + file.getAbsolutePath()); } } }