Here you can find the source of getAllFilesFromFolder(File aFolder, FilenameFilter filenameFilter)
Parameter | Description |
---|---|
aFolder | a parameter |
filenameFilter | a parameter |
public static List<File> getAllFilesFromFolder(File aFolder, FilenameFilter filenameFilter)
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt import java.io.File; import java.io.FileFilter; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { /**//from w w w. jav a 2 s . c om * DOC sgandon Comment method "getAllFilesFromFolder". * * @param aFolder * @param fileList * @param filenameFilter */ public static void getAllFilesFromFolder(File aFolder, List<File> fileList, FilenameFilter filenameFilter) { File[] folderFiles = aFolder.listFiles(filenameFilter); if (fileList != null && folderFiles != null) { Collections.addAll(fileList, folderFiles); } File[] allFolders = aFolder.listFiles(new FileFilter() { @Override public boolean accept(File arg0) { return arg0.isDirectory(); } }); if (allFolders != null) { for (File folder : allFolders) { getAllFilesFromFolder(folder, fileList, filenameFilter); } } } /** * DOC xqliu Comment method "getAllFilesFromFolder". * * @param aFolder * @param filenameFilter * @return */ public static List<File> getAllFilesFromFolder(File aFolder, FilenameFilter filenameFilter) { List<File> files = new ArrayList<File>(); getAllFilesFromFolder(aFolder, files, filenameFilter); return files; } }