Java Directory to File List getAllFilesFromFolder(File sampleFolder, ArrayList fileList, FilenameFilter filenameFilter)

Here you can find the source of getAllFilesFromFolder(File sampleFolder, ArrayList fileList, FilenameFilter filenameFilter)

Description

DOC sgandon Comment method "getAllFilesFromFolder".

License

Open Source License

Parameter

Parameter Description
sampleFolder a parameter
arrayList a parameter
filenameFilter a parameter

Declaration

public static void getAllFilesFromFolder(File sampleFolder, ArrayList<File> fileList,
        FilenameFilter filenameFilter) 

Method Source Code

//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;

public class Main {
    /**/*from  w  w  w . j a  v a  2 s.  c om*/
     * DOC sgandon Comment method "getAllFilesFromFolder".
     * 
     * @param sampleFolder
     * @param arrayList
     * @param filenameFilter
     */
    public static void getAllFilesFromFolder(File sampleFolder, ArrayList<File> fileList,
            FilenameFilter filenameFilter) {
        File[] folderFiles = sampleFolder.listFiles(filenameFilter);
        Collections.addAll(fileList, folderFiles);
        File[] allFolders = sampleFolder.listFiles(new FileFilter() {

            public boolean accept(File arg0) {
                return arg0.isDirectory();
            }
        });
        for (File folder : allFolders) {
            getAllFilesFromFolder(folder, fileList, filenameFilter);
        }
    }
}

Related

  1. getAllFilesEndingWith(String path, final String extension)
  2. getAllFilesEndingWith(String path, final String extension)
  3. getAllFilesForType(File dir, FilenameFilter filter)
  4. getAllFilesFromDir(File dir)
  5. getAllFilesFromFolder(File aFolder, FilenameFilter filenameFilter)
  6. getAllFilesIn(File dir, final String type)
  7. getAllFilesInAllSubDirectories(File parentDir, FileFilter filter)
  8. getAllFilesInDir(boolean traverseSubDirs, File dir, boolean includeHidden, String prefix)
  9. getAllFilesInDirectory(File dir)