import java.io.File;
public class FileList{
public static void main(String[] args){
File f = new File("d:/java");
System.out.println(f.getName());
tree(f,0);
}
private static void tree(File f, int level){
String preStr = "";
for(int i=0; i<level; i++){
preStr += " ";
}
File[] child = f.listFiles();
for(int i=0; i<child.length; i++){
System.out.println(preStr + child[i].getName());
if(child[i].isDirectory()){
tree(child[i],level++);
}
}
}
}