Here you can find the source of getFiles(File folder, FilenameFilter filter)
public static List<File> getFiles(File folder, FilenameFilter filter)
//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<File> getFiles(File folder, FilenameFilter filter) { return getFiles(folder, filter, true); }//from w w w.j a v a 2s .c o m public static List<File> getFiles(File folder, FilenameFilter filter, Boolean recursive) { List<File> files = new ArrayList<File>(); if (folder.isDirectory()) { for (File file : folder.listFiles(filter)) { if (file.isDirectory()) { files.addAll(getFiles(file, filter, recursive)); } else { files.add(file); } } } return files; } }