What I need to do if Search a folder say C:\\example
I then need to go through each file and check to see if it matches a few start characters so if fil
For list out Json files from your given directory.
import java.io.File;
import java.io.FilenameFilter;
public class ListOutFilesInDir {
public static void main(String[] args) throws Exception {
File[] fileList = getFileList("directory path");
for(File file : fileList) {
System.out.println(file.getName());
}
}
private static File[] getFileList(String dirPath) {
File dir = new File(dirPath);
File[] fileList = dir.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.endsWith(".json");
}
});
return fileList;
}
}