谢大家 rt
------解决方案--------------------
import java.io.*;
public class FindDirectories
{
public static void main(String[] args)
{
// if no arguments provided, start at the parent directory
FindDirectories.FindFiles( "c:\\ ");
}
public static void FindFiles(String str)
{
try
{
File pathName = new File(str);
String[] fileNames = pathName.list();
// enumerate all files in the directory
for (int i = 0; i < fileNames.length; i++)
{
File f = new File(pathName.getPath(), fileNames[i]);
// if the file is again a directory, call the main method recursively
if (f.isDirectory())
{
// System.out.println(f.getCanonicalPath());
FindFiles(f.getPath());
}
else
{
System.out.println(f.getCanonicalPath());
}
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
------解决方案--------------------
D 楼上