Here you can find the source of getAllFilesInFolder(String folder)
public static String[] getAllFilesInFolder(String folder)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String[] getAllFilesInFolder(String folder) { File file = load(folder); if (file != null) { if (file.exists()) { if (file.isDirectory()) { File[] fileList = file.listFiles(); String[] fileNames = new String[fileList.length]; for (int i = 0; i < fileNames.length; i++) { fileNames[i] = fileList[i].getName(); }/*from w w w .ja va2 s . c o m*/ return fileNames; } } } return new String[] {}; } public static File load(String filePath) { File file = new File(filePath); if (file.exists()) { return file; } return null; } public static boolean isDirectory(String filePath) { File file = load(filePath); if (file != null) { return file.isDirectory(); } return false; } }