Here you can find the source of find(String path, String matcher)
public static List<File> find(String path, String matcher)
//package com.java2s; import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { public static List<File> find(String path, String matcher) { List<File> files = new ArrayList<File>(); File root = new File(path); File[] list = root.listFiles(); if (list == null) return files; for (File file : list) { if (file.getName().matches(matcher)) { files.add(file);// ww w . j a v a 2 s.c om } if (file.isDirectory()) { files.addAll(find(file.getAbsolutePath(), matcher)); } } return files; } }