Java Folder Read by Extension getFilesForType(final File target, final String extension)

Here you can find the source of getFilesForType(final File target, final String extension)

Description

get Files For Type

License

Open Source License

Declaration

public static File[] getFilesForType(final File target,
            final String extension) 

Method Source Code

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

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

public class Main {
    public static File[] getFilesForType(final File target,
            final String extension) {
        File[] files = target.listFiles(new FileFilter() {
            public boolean accept(File pathname) {
                if (pathname.getName().indexOf(extension) != -1) {
                    return true;
                }//from  ww w .  ja  v  a  2  s.com
                return false;
            }
        });
        return files;
    }
}

Related

  1. getFiles(String directory, String ext)
  2. getFiles(String path, String _exts)
  3. getFiles(String path, String[] allowedExtension)
  4. getFiles2List(String path, String[] allowedExtension)
  5. getFilesFiteredByExtension(final File parent, final List extensions)
  6. getFilesFromExtension(String directory, String[] extensions)
  7. getFilesWithExtension(File aDirectory, final String aExtension)
  8. getFilesWithExtension(File dir, String extension)
  9. getFilesWithExtension(String directory, String extension)