I have a directory, C:\myDir.
under this directory, there may be folders and various files
How can I “loop” through this directory and build up a File array of all files with a .properties extension?
I want to do some processing on these files, the reason for a File[] is to keep it dynamic (so additional properties files added in the future will be included)
I’m hoping to do something like this :
public static void main (String[] vargs)
{
// find all .properties files
//
//loop through property file and process
{
doSomething(myFile[i]);
}
}
public void doSomething(File myfile) {}
Here is a complete answer without external libs:
Call it like this: