Java Delete File on Exit deleteOnExitRecursive(File file)

Here you can find the source of deleteOnExitRecursive(File file)

Description

delete On Exit Recursive

License

Apache License

Declaration

public static void deleteOnExitRecursive(File file) 

Method Source Code


//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);
    }
}

Related

  1. deleteOnExit(File dir)
  2. deleteOnExit(File file)
  3. deleteOnExit(File file)
  4. deleteOnExit(final File file)
  5. deleteOnExit(final File file)