Java File Delete nio deleteRecursively(File fileOrDir)

Here you can find the source of deleteRecursively(File fileOrDir)

Description

delete Recursively

License

Open Source License

Declaration

public static void deleteRecursively(File fileOrDir) 

Method Source Code


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

import java.io.File;

import java.nio.file.Files;

public class Main {
    public static void deleteRecursively(File fileOrDir) {
        if (fileOrDir.isDirectory() && !Files.isSymbolicLink(fileOrDir.toPath()))
            for (File f : fileOrDir.listFiles())
                deleteRecursively(f);//from w  w  w.  j a v a  2 s.  co m
        fileOrDir.delete();
    }
}

Related

  1. deleteLocalFileOrDirectory(File file)
  2. deleteMatching(File baseFile, String regex)
  3. deletePidFile()
  4. deleteQuietly(File file)
  5. deleteRecursive(File fileOrDirectory)
  6. deleteRecursively(File root)
  7. deleteTestFile(String extension)
  8. forceDelete(File file)
  9. forceDelete(File file)