我给你个例子,你把其中的路径File file = new File("c:\\tmp\\5");改成你的路径就行了。
public class Test2
{
public static void main(String[] args)
{
File file = new File("c:\\tmp\\5");
Test2 t = new Test2();
t.method(file);
}
public void method(File f)
{
File[] FList = f.listFiles();
for (int i = 0; i < FList.length; i++)
{
if (FList[i].isDirectory()==true)
{
method(FList[i]);
}
else
{
System.out.println(FList[i].getAbsolutePath());
}
}
}
}
追问能在百度hi上讨论一下麽?hi你了……
追答我也hi你了。上面的例子程序是一个简单的递归程序。