Here you can find the source of getAllFileNamesInDir(String folderName)
Parameter | Description |
---|---|
folderName | the folder name |
public static List<String> getAllFileNamesInDir(String folderName)
//package com.java2s; //License from project: LGPL import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { /**//from w ww . j av a2 s . c om * Gets the all file names in dir. * * @param folderName the folder name * @return the all file names in dir */ public static List<String> getAllFileNamesInDir(String folderName) { List<String> fileList = new ArrayList<String>(); File folder = new File(folderName); if (folder.exists() && folder.isDirectory()) { File[] libs = folder.listFiles(); for (File lib : libs) { fileList.add(lib.getPath()); } } return fileList; } }