Java File List Load getFilesFromDirectory(final File folder)

Here you can find the source of getFilesFromDirectory(final File folder)

Description

get Files From Directory

License

Open Source License

Declaration

static List<File> getFilesFromDirectory(final File folder) 

Method Source Code

//package com.java2s;

import java.io.File;

import java.util.ArrayList;
import java.util.List;

public class Main {
    static List<File> getFilesFromDirectory(final File folder) {
        List<File> fileList = new ArrayList<>();
        File[] list = folder.listFiles();

        if (list == null) {
            return fileList;
        }/*from  w  w  w .  ja v  a  2s  . co m*/

        for (final File fileEntry : list) {

            if (!fileEntry.isDirectory()) {
                fileList.add(fileEntry);
            }
        }

        return fileList;
    }
}

Related

  1. getFileListing(File file, String... extension)
  2. getFileListingLogs(File aStartingDir)
  3. getFileListingNoSort(File aStartingDir, boolean recursive)
  4. getFilesByExt(String dirName, String ext)
  5. getFilesFromDir(File dir)
  6. getFilesFromDirectory(final String directory)
  7. getFilesFromDirectoryByExtension(File directory, String extension)