Java Folder Read getFiles(String folderName, String prefix)

Here you can find the source of getFiles(String folderName, String prefix)

Description

get Files

License

Apache License

Declaration

static Collection<File> getFiles(String folderName, String prefix) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.util.ArrayList;
import java.util.Collection;

public class Main {
    static Collection<File> getFiles(String folderName, String prefix) {
        File folder = new File(folderName);
        File[] files = folder.listFiles();
        ArrayList<File> result = new ArrayList<File>(files.length);
        for (File file : files) {
            if (file.isFile() && file.getName().startsWith(prefix)) {
                result.add(file);//  www  .  j  a  va2s .  c  o  m
            }
        }
        return result;
    }
}

Related

  1. getFiles(String dir)
  2. getFiles(String dir)
  3. getFiles(String dir)
  4. getFiles(String directoryPath)
  5. getFiles(String dirName, int number)
  6. getFiles(String parent)
  7. getFiles(String path)
  8. getFiles(String path)
  9. getFiles(String path)