Java Utililty Methods Delete Directory on Exit

List of utility methods to do Delete Directory on Exit

Description

The list of methods to do Delete Directory on Exit are organized into topic(s).

Method

voiddeleteDirectoryOnExit(File directory)
Schedules a directory recursively for deletion on JVM exit.
if (!directory.exists()) {
    return;
directory.deleteOnExit();
voiddeleteDirectoryOnExit(File directory)
delete Directory On Exit
if (!directory.exists()) {
    return;
cleanDirectoryOnExit(directory);
directory.deleteOnExit();
voiddeleteDirectoryOnExit(File directory)
delete Directory On Exit
if (!directory.exists()) {
    return;
directory.deleteOnExit();
if (!isSymlink(directory)) {
    cleanDirectoryOnExit(directory);
voiddeleteDirectoryOnExit(final File dir)
Instructs Java to recursively delete the given directory (dir) and its contents when the JVM exits.
dir.deleteOnExit();
if (dir.isDirectory()) {
    File[] childFiles = dir.listFiles();
    if (childFiles != null) { 
        for (File f : childFiles) {
            deleteDirectoryOnExit(f);