Java File Path Delete deleteRecursive(File path)

Here you can find the source of deleteRecursive(File path)

Description

delete Recursive

License

LGPL

Declaration

public static boolean deleteRecursive(File path) throws FileNotFoundException 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.io.File;

import java.io.FileNotFoundException;

public class Main {
    public static boolean deleteRecursive(File path) throws FileNotFoundException {
        if (path.exists()) {
            boolean ret = true;

            if (path.isDirectory()) {
                for (File f : path.listFiles()) {
                    ret = ret && deleteRecursive(f);
                }/*from ww  w  .  j ava2s  .  c o  m*/
            }
            return ret && path.delete();
        } else {
            return false;
        }
    }
}

Related

  1. deletePath(File path)
  2. deletePath(final File path)
  3. deletePathRecursive(File path)
  4. deleteQuietly(Object path)
  5. deleteRecursive(File path)
  6. deleteRecursive(File path)
  7. deleteRecursive(File path)
  8. deleteRecursive(File path)
  9. deleteRecursive(File path)