import java.util.*;
import java.io.*;
public class TestFile{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
System.out.print("请输入文件名:");
String name=sc.nextLine();
File f=new File(name);
if(!f.exists()){
System.out.println("没有该文件!!");
}else{
print(f,0);
}
}
public static void print(File f,int level){
for(int i=0;i<level;i++){
System.out.print(" ");
}
System.out.println(f.getName());
if(f.isDirectory()&&f.canRead()){
for(File subf:f.listFiles())
print(subf,level+1);
}
}
}