日期:2014-05-19 浏览次数:20873 次
public static void getAllFile(String path)
{
File file = new File(path);
File[] fileArray = file.listFiles();
if (fileArray != null)
{
for (File fileTemp : fileArray)
{
if (fileTemp.isFile()) // true:is a file false: is a folder
{
System.out.println(fileTemp.getAbsolutePath());
}
else
{
getAllFile(fileTemp.getPath());
}
}
}
}
public static void main(String[] args){
getAllFile("c://Program Files");
}
------解决方案--------------------