Here you can find the source of getFiles(String dir)
private static List<String> getFiles(String dir)
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.ArrayList; import java.util.List; public class Main { private static List<String> getFiles(String dir) { List<String> lstFiles = new ArrayList<>(); File file = new File(dir); File[] files = file.listFiles(); if (files != null) { for (File f : files) { if (f.isDirectory()) { lstFiles.add(f.getAbsolutePath()); lstFiles.addAll(getFiles(f.getAbsolutePath())); } else { String str = f.getAbsolutePath(); lstFiles.add(str);//from www.ja v a 2 s . c o m } } } return lstFiles; } }