1
I’m trying to mount a file tree where in addition to displaying the computer directories is displayed also your files. The code I made below is listing only the specified directory, in case the C:\
. But the directories contained within the C:
such as "Program Files" does not display what is inside.
package arvore;
import java.io.File;
public class Arvore {
public static void main(String[] args) {
File folder = new File("C:\\");
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
System.out.println("Este é Arquivo " + listOfFiles[i].getName());
} else if (listOfFiles[i].isDirectory()) {
System.out.println("***ESTE E DIRETÓRIO " + listOfFiles[i].getName());
}
}
}
}
The question is how would it look to show everyone including subdirectories.
Yes really I took a look at it and it lacks nothing, the question is... What if I had more than one directory ? It would show everyone and their respective directories?
– Valdecir