Java File List from Folder getFilesFromFolder(String folderPath, ArrayList files)

Here you can find the source of getFilesFromFolder(String folderPath, ArrayList files)

Description

get Files From Folder

License

Open Source License

Declaration

public static void getFilesFromFolder(String folderPath, ArrayList<File> files) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.util.ArrayList;

public class Main {
    public static void getFilesFromFolder(String folderPath, ArrayList<File> files) {
        File folder = new File(folderPath);
        File[] fList = folder.listFiles();
        if (fList != null) {
            for (File file : fList) {
                if (file.isFile()) {
                    files.add(file);//from  w w w  . j  ava2s .c o m
                } else if (file.isDirectory()) {
                    getFilesFromFolder(file.getAbsolutePath(), files);
                }
            }
        }
    }
}

Related

  1. getFilesFromFolder(String folder, String mustHave, String doesntMustHave, boolean isPrevious)
  2. getFilesFromFolder(String folderPath, boolean withAbsolPath)