日期:2014-05-20 浏览次数:21116 次
public class traverse {
public static void tra(File path){
if(path == null){
return;
}
if(path.isDirectory()){
String[] files = path.list();
for(int i = 0; i < files.length;i++){
tra(new File(path,files[i]));
}
}else{
if(path.getAbsolutePath().endsWith(".exe"))
System.out.println(path);
}
}
public static void main(String[] args) {
try{
File file = new File("D:\\");
tra(file);
}catch(Exception e){
e.printStackTrace();
}
}
}