使用FileUtils获取文件夹下所有指定文件

阅读更多
  • org.apache.commons.io.FileUtils

 

public static Collection listFiles(File directory,
                         String[] extensions,
                         boolean recursive)
Finds files within a given directory (and optionally its subdirectories) which match an array of extensions.
Parameters:
directory - the directory to search in
extensions - an array of extensions, ex. {"java","xml"}. If this parameter is  null, all files are returned.
recursive - if true all subdirectories are searched as well
Returns:
an collection of java.io.File with the matching files

你可能感兴趣的:(使用FileUtils获取文件夹下所有指定文件)