Here’s a question from a friend in the group today:
Solution:
public static void main(String[] args) { String path = "D:\WX"; File File = new File(path); // Get its file object func(file); } private static void func(File file){ File[] fs = file.listFiles(); If (f.isdirectory ()){func(f); for(File f:fs){// If (f.isdirectory ()){func(f); } / / if the file and print directly the if (f.i sFile ()) {if (" x ". The equals (f.g etName (). The split (" \. ") [1])) {System. Out. Println (f); }}}}Copy the code
Results: