Java Recursive Delete recursiveDelete(File file)

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

Description

Recursivelly delete a file or directory

License

Open Source License

Declaration

public static void recursiveDelete(File file) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.util.logging.Logger;

public class Main {
    /**//from  w w  w  .jav  a2  s .  co m
     * Recursivelly delete a file or directory
     */
    public static void recursiveDelete(File file) {
        if (file != null) {
            if (file.isDirectory()) {
                for (File subFile : file.listFiles()) {
                    recursiveDelete(subFile);
                }
            }
            if (!file.delete()) {
                Logger.global.info("Could not delete file " + file);
            }
        }
    }
}

Related

  1. recursiveDelete(File file)
  2. recursiveDelete(File file)
  3. recursiveDelete(File file)
  4. recursiveDelete(File file)
  5. recursiveDelete(File file)
  6. recursiveDelete(File file)
  7. recursiveDelete(File file)
  8. recursiveDelete(File file)
  9. recursiveDelete(File file)