Java Folder Read getFilesByType(String path, final String type)

Here you can find the source of getFilesByType(String path, final String type)

Description

get Files By Type

License

Open Source License

Declaration

public static File[] getFilesByType(String path, final String type) 

Method Source Code

//package com.java2s;
import java.io.File;
import java.io.FileFilter;

public class Main {
    public static File[] getFilesByType(String path, final String type) {
        File dir = new File(path);
        File[] files = dir.listFiles(new FileFilter() {
            public boolean accept(File afile) {
                return afile.getName().endsWith(type) && afile.isFile();
            }// ww w. ja v a2  s  .  co  m
        });
        return files == null ? new File[] {} : files;
    }
}

Related

  1. getFilesByDate(String directory, final boolean earliestFirst)
  2. getFilesByName(File path, String name)
  3. getFilesByPath(String toDir)
  4. getFilesByRegxFileName(String dir, final String regxName)
  5. getFilesByType(String fileType, String path)
  6. getFilesCannotAccess(File... files)
  7. getFilesComposingPath(File aFile)
  8. getFilesCount(File archiveFile)
  9. getFileset(File projectFolder)