public class FildFilePath {
public static void main(String[] args) {
File file = new File("D:\\");
File[] files = file.listFiles();
for (File file1 : files) {
findFile(file1);
}
}
public static boolean findFile(File file){
File[] files = file.listFiles();
if (files == null){
return false;
}
if (files.length == 0){
return false;
}
for (File file1 : files) {
if (file1.isFile()){
if (file1.getName().equals("org.eclipse.rcp_root_4.18.0.v20201202-1800")){
System.out.println(file1.getAbsolutePath());
return true;
}
}else {
findFile(file1);
}
}
return false;
}
}
查找指定盘符下的文件路径
最新推荐文章于 2024-05-03 16:12:22 发布