List all .txt files in a directory (args[0])
File inputDir = new File(args[0]);
//list all .txt files
File [] children = inputDir.listFiles();
for (int i = 0; i < children.length; ++i){
if (!children[i].getName().endsWith(".txt"))
continue;
System.out.println("Reading file: " + children[i].getPath());
}
Comments
Post a Comment