How does Android traverse and read the files under the folder and its sub-files under the specified path?

  android, question

For example, there are many subfolders under the html file ad folder of the following path/MNT/SD Card/AD/_ _ _ _/index.html, and the subfolder inside has html. How to traverse and read?

void getAllFiles(File root){

File files[] = root.listFiles();
 if(files !  = null){
 for (File f : files){
 if(f.isDirectory()){
 getAllFiles(f);
 }else{
 System.out.println(f);
 bracket
 bracket
 bracket