Here you can find the source of listFile(File file)
public static List<String> listFile(File file)
//package com.java2s; //License from project: Apache License import java.io.File; import java.util.ArrayList; import java.util.List; public class Main { private static List<String> fileNames = new ArrayList<>(); public static List<String> listFile(File file) { if (file.isDirectory()) { File[] files = file.listFiles(); for (File f : files) { listFile(f);//from w ww. j a va2s . c o m } } else { fileNames.add(file.getAbsolutePath()); } return fileNames; } }