Что мне нужно сделать, если поиск в папке говорит C:\example
Затем мне нужно пройти каждый файл и проверить, совпадает ли он с несколькими начальными символами, поэтому если файлы начинаются
temp****.txt
tempONE.txt
tempTWO.txt
Итак, если файл начинается с temp и имеет расширение .txt, я хотел бы затем поместить это имя файла в File file = new File("C:/example/temp***.txt);
, чтобы затем прочитать его в файле, тогда цикл должен перейти к следующему файлу проверьте, соответствует ли он, как указано выше.