import java.io.*;
class digui
{
public static void fun(File file)
{
if(file.isDirectory())
{
File f[] = file.listFiles();
if(f!=null)
{
for(int x=0;x<f.length;x++)
{
fun(f[x]);
}
}else{
System.out.println(file);
}
}
}
public static void main(String[] args)
{
File file = new File("D:"+File.separator+"CODE");
fun(file);
}
}
原文:http://www.cnblogs.com/kevinfuture/p/4374943.html