使用File类列出指定位置的文件信息,包含该路径子目录下的文件信息

public class Test{
public static void main(String [] args)
{
File f=new File("d:");
File [] fl=f.listFiles();
show(f1);
}
public static void show(File [] f1)
{
for(File f:fl)
{
if(f.isDirectory())
{
File [] f2=f.listFiles();
show(f2);
}
else
{
System.out.println(f);
}
 
 
}
}
 
 
}
posted @ 2016-10-12 22:38  ruiguang21  阅读(190)  评论(0编辑  收藏  举报