Here you can find the source of getFileList(String folderPath)
Parameter | Description |
---|---|
folderPath | a parameter |
public static List<File> getFileList(String folderPath)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { /**/*from www. j a va 2s. c o m*/ * listFilesForFolder * * @param folderPath * @return */ public static List<File> getFileList(String folderPath) { // create output array List<File> files = new ArrayList<>(); // create file object File folder = new File(folderPath); // iterate folder files for (final File fileEntry : folder.listFiles()) { // check if it's a file if (fileEntry.isFile()) { // save file paths in array files.add(fileEntry); } } // return list return files; } }