Here you can find the source of deleteOnExitRecursive(File file)
public static void deleteOnExitRecursive(File file)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static void deleteOnExitRecursive(File file) { if (!file.exists()) return; file.deleteOnExit();/* w w w .j ava2 s .c o m*/ if (!file.isDirectory()) return; for (File f : file.listFiles()) deleteOnExitRecursive(f); } }