Here you can find the source of getFiles(File folder)
public static List<File> getFiles(File folder)
//package com.java2s; //License from project: Apache License import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { public static List<File> getFiles(File folder) { if (!folder.exists()) folder.mkdirs();//from w w w. j a v a2 s. c o m List<File> list = new ArrayList<File>(); for (File fileEntry : folder.listFiles()) { if (fileEntry.isDirectory()) { getFiles(fileEntry); } else { list.add(fileEntry); } } return list; } }