public static List<File> getFilesForPattern(String path, Pattern pattern) throws IOException {
    List<File> result = new ArrayList<>();
    Files.walkFileTree(Paths.get(path), new SimpleFileVisitor<Path>() {
      @Override
      public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
        if (pattern.matcher(file.toFile().getName()).matches()) {
          result.add(file.toFile());
        }
        return FileVisitResult.CONTINUE;
      }

      @Override
      public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
        return FileVisitResult.CONTINUE;
      }
    });
    return result;
  }
Walks the directory and returns all files that match the pattern
@param path
@param pattern
@return List<File>
@throws IOException
ambry-utils/src/main/java/com/github/ambry/utils/Utils.java