标签:
public static void main(String[] args) {
traverseFileFolders(new File("D:"));
traverseFileFolders(new File("D:\\apache-tomcat-6.0.33\\conf"));
}
public static void traverseFileFolders(File base){
if(base!=null)traverseFileFolders(base.getAbsolutePath());
}
public static void traverseFileFolders(String path){
path = StringUtils.trim(path);
if(path==null)return;
File file = new File(path);
if(!file.exists())return;
if(file.isFile())
{
System.out.print(file.getName()+":");
System.out.println(file.getAbsolutePath());
return;
}
File[] files = file.listFiles();
for(File each:files)
{
String eachPath = each.getAbsolutePath();
traverseFileFolders(eachPath);
}
}
标签:
原文地址:http://my.oschina.net/u/1587544/blog/514605