Here you can find the source of getFiles(String rootDirectory)
public static List<String> getFiles(String rootDirectory)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> getFiles(String rootDirectory) { File[] files = new File(rootDirectory).listFiles(); List<String> result = new ArrayList(); for (File file : files) { if (!file.isDirectory()) { result.add(file.getAbsolutePath()); // System.out.println("File:" + file.getAbsolutePath()); } else if (file.isDirectory()) { // System.out.println("Dir:" + file.getAbsolutePath()); result.addAll(getFiles(file.getAbsolutePath())); }/*from www . ja v a 2s.com*/ } return result; } }