Java File Delete nio delete(File toRecurse)

Here you can find the source of delete(File toRecurse)

Description

delete

License

Open Source License

Declaration

public static void delete(File toRecurse) throws IOException 

Method Source Code


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

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

import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Comparator;

public class Main {
    public static void delete(File toRecurse) throws IOException {
        Files.walk(toRecurse.toPath(), FileVisitOption.FOLLOW_LINKS).sorted(Comparator.reverseOrder())
                .map(Path::toFile).forEach(File::delete);
    }/*w  ww .  ja  va2s  .c o  m*/
}

Related

  1. delete(File file)
  2. delete(File file)
  3. delete(File file)
  4. delete(File file)
  5. delete(File file)
  6. delete(final File directory, final FileFilter fileFilter)
  7. deleteAll(File f)
  8. deleteAll(File file)
  9. deleteEntriesFromZip(File zipFile, List entriesToDelete)