Java Delete File Recursively deleteRecursive(File toDelete)

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

Description

delete Recursive

License

LGPL

Declaration

public static void deleteRecursive(File toDelete) 

Method Source Code


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

import java.io.File;

public class Main {
    public static void deleteRecursive(File toDelete) {
        if (toDelete.isFile()) {
            toDelete.delete();/*from   w  w w  .ja v  a 2 s.c  om*/
        } else if (toDelete.isDirectory()) {
            for (File f : toDelete.listFiles()) {
                deleteRecursive(f);
            }
        }
    }
}

Related

  1. deleteRecursive(File file)
  2. deleteRecursive(File file)
  3. deleteRecursive(File root)
  4. deleteRecursive(File src)
  5. deleteRecursive(File src, List excludes)
  6. deleteRecursive(File toDelete)
  7. deleteRecursive(final File dir)
  8. deleteRecursive(final File file)
  9. deleteRecursive(final File file)