private static boolean isDirectoryExist(@NotNull VirtualFile root, @NotNull Pattern pattern) {
    Ref<Boolean> found = Ref.create(false);
    VfsUtilCore.iterateChildrenRecursively(root, file -> file.isDirectory(), (dir) -> {
      ProgressManager.checkCanceled();
      String path = VfsUtilCore.getRelativePath(dir, root);
      if (path != null && RegexUtil.match(pattern, path)) {
        found.set(true);
        return false;
      }
      return true;
    });
    return found.get();
  }
private static boolean isDirectoryExist(@NotNull VirtualFile root, @NotNull Pattern pattern)