Studyon Minte9.com
Java SE




Read Directory




package testexample; import java.io.*; import java.util.*; public class Test { public static void main(String[] args) { ArrayList<String> filesNames = new ArrayList<String>(); File folder = new File("data/"); // data: file1.txt, file2.txt for(File file:folder.listFiles()) { filesNames.add(file.getName()); } for(String filename:filesNames) { System.out.println(filename); // Output: file1.txt, file2.txt } } }
 


http://stackoverflow.com/questions/1844688/read-all-files-in-a-folder