What is the best way to find a directory with a specific name in Java? The directory that I am looking for can be located either in the current directory or one of its subdi
In Java 8 via the streams API:
Optional hit = Files.walk(myPath) .filter(file -> file.getFileName().equals(myName)) .findAny();
The #walk is lazy, so any short-circuiting terminal operation will optimize the IO required.