Java File Delete nio delete(final File directory, final FileFilter fileFilter)

Here you can find the source of delete(final File directory, final FileFilter fileFilter)

Description

delete

License

Open Source License

Declaration

public static void delete(final File directory, final FileFilter fileFilter) throws IOException 

Method Source Code


//package com.java2s;

import java.io.File;
import java.io.FileFilter;

import java.io.FileNotFoundException;
import java.io.IOException;

import java.nio.file.Files;

public class Main {
    public static void delete(final File directory, final FileFilter fileFilter) throws IOException {
        if (!directory.exists() || !directory.isDirectory())
            throw new FileNotFoundException("No directory found at " + directory);
        for (File file : directory.listFiles(fileFilter))
            Files.delete(file.toPath());
    }/*from w  w w.java2s  . co m*/
}

Related

  1. delete(File file)
  2. delete(File file)
  3. delete(File file)
  4. delete(File file)
  5. delete(File toRecurse)
  6. deleteAll(File f)
  7. deleteAll(File file)
  8. deleteEntriesFromZip(File zipFile, List entriesToDelete)
  9. deleteFile(File f)