Here you can find the source of recursiveDeleteOnExit(File parent)
Parameter | Description |
---|---|
parent | a parameter |
static public final void recursiveDeleteOnExit(File parent)
//package com.java2s; /*// ww w.ja va 2 s . com * Copyright (c) 2012 Diamond Light Source Ltd. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html */ import java.io.File; public class Main { /** * Recursively delete parent folder on exit of JVM * * @param parent */ static public final void recursiveDeleteOnExit(File parent) { parent.deleteOnExit(); if (parent.isDirectory()) { File[] files = parent.listFiles(); for (int ifile = 0; ifile < files.length; ++ifile) { if (files[ifile].isDirectory()) { recursiveDeleteOnExit(files[ifile]); } files[ifile].deleteOnExit(); } } } }