I want to create a method that will search files by name. I have variable with a name and I need method that search file with that name in one folder. This is my sample code:
public class Searching {
File file = new File("C:/Dane DMS/");
static ArrayList <String>listaPlikowJava = new ArrayList <String> ();
public void szukanie(File file)
{
for (File szukany : file.listFiles())
{
if(szukany.isDirectory())
szukanie(szukany);
else {
String temp[] = szukany.getName().split(".");
if (temp[1].equals("a")) listaPlikowJava.add(szukany.getName());
}
}
}
}
What do you think about this idea?