Java Path Delete nio recursiveDelete(Path pathToBeDeleted)

Here you can find the source of recursiveDelete(Path pathToBeDeleted)

Description

recursive Delete

License

Apache License

Declaration

public static void recursiveDelete(Path pathToBeDeleted) throws IOException 

Method Source Code


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

import java.io.File;
import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Path;

import java.util.Comparator;

public class Main {
    public static void recursiveDelete(Path pathToBeDeleted) throws IOException {
        Files.walk(pathToBeDeleted).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
    }/*from   w w  w . ja v a2s .c  om*/
}

Related

  1. forceDelete(Path path)
  2. optimisticDelete(Path path)
  3. readAndDelete(final Path p)
  4. recursiveDelete(Path directory)
  5. recursiveDelete(Path path)
  6. recursiveDeleteDirectory(Path dir)
  7. recursiveDeleteOnShutdownHook(final Path path)
  8. recursivelyDeleteFilesFromDir(Path aDirectory)
  9. recusiveDeleteIfExists(Path p)