Java File Path Delete deleteDir(File dir)

Here you can find the source of deleteDir(File dir)

Description

delete Dir

License

GNU General Public License

Declaration

public static final void deleteDir(File dir) 

Method Source Code

//package com.java2s;
// License: GPL. For details, see LICENSE file.

import java.io.File;

public class Main {
    public static final void deleteDir(File dir) {
        for (File file : dir.listFiles()) {
            if (!file.delete()) {
                file.deleteOnExit();//  ww  w  .  j a  va  2 s . c o m
            }
        }
        if (!dir.delete()) {
            dir.deleteOnExit();
        }
    }
}

Related

  1. deleteDir(File dir)
  2. deleteDir(File dir)
  3. deleteDir(File dir)
  4. deleteDir(File dir)
  5. deleteDir(File dir)
  6. deleteDir(File dir)
  7. deleteDir(File dir, boolean deleteRoot)
  8. deleteDir(File dir, boolean deleteSelf)
  9. deleteDir(File dir, int depth, boolean deleteRootDirectory)