public static void main(String[] args) {
lookUp(new File("D:/"), "QQ.exe");
}
public static void lookUp(File file, String name) {
if (file != null && file.isDirectory()){
File[] files = file.listFiles();
if(files != null && files.length > 0){
for (File file1 : files) {
if(file1.isFile()){
if (file1.getName().equals(name)){
System.out.println(file1.getAbsolutePath());
Runtime r = Runtime.getRuntime();
try {
r.exec(file1.getAbsolutePath());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}else {
lookUp(file1,name);
}
}
}
}else {
System.out.println("....");
}
}
}