Here you can find the source of getAllFiles(String folderPath)
public static List<File> getAllFiles(String folderPath)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.ArrayList; import java.util.List; public class Main { public static List<File> getAllFiles(String folderPath) { List<File> list = new ArrayList<File>(); File file = getFile(folderPath); if (file.exists() && file.isDirectory()) { File filesTemp[] = file.listFiles(); for (int i = 0; i < filesTemp.length; i++) { list.add(filesTemp[i]);//from www .j av a 2 s. co m } } return list; } public static File getFile(String filePath) { File file = null; file = new File(filePath); return file; } public static boolean exists(String filePath) { boolean flag = false; File file = getFile(filePath); if (file != null && file.exists() && file.isFile()) { flag = true; } return flag; } }