Java Folder Read getFilesInFolder(final String pathToFolder, final String suffix)

Here you can find the source of getFilesInFolder(final String pathToFolder, final String suffix)

Description

get Files In Folder

License

Open Source License

Declaration

public static List<String> getFilesInFolder(final String pathToFolder, final String suffix) 

Method Source Code

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

import java.io.File;

import java.io.FilenameFilter;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> getFilesInFolder(final String pathToFolder, final String suffix) {
        File folder = new File(pathToFolder);

        String[] files = folder.list(new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return name.toUpperCase().endsWith(suffix.toUpperCase());
            }//  ww  w. ja va 2  s . c o  m
        });

        List<String> ret = new ArrayList<String>();
        for (String file : files) {
            ret.add(pathToFolder + File.separator + file);
        }

        return ret;
    }
}

Related

  1. getFilesFromDiskWorker(File folderToLoad, final String searchPattern, final boolean justFolders)
  2. getFileSimpleName(final File f)
  3. getFilesInClassPath(String path, String endsWith)
  4. getFilesIncludeSubdirectories(final File directory)
  5. getFilesInFolder(File dir)
  6. getFilesInFolderByRegex(File folder, final String regex)
  7. getFilesMatchingRegexp(final File directory, final String regexp)
  8. getFilesModDate(String path)
  9. getFilesOf(File dir)