def recursive_tree_traverse(
    tree_urls: List[str], acc: List[str], source_tree_url: str
) -> List[str]:
    """Recursively traversge Github trees to get all file paths in a folder."""
    if not tree_urls:
        return acc
    else:
        url = tree_urls[0]

        try:
            res = requests.get(url, headers={"Accept": "application/json"})
            tree_elements = res.json()["payload"]["tree"]["items"]
        except Exception:
            raise ValueError("Failed to traverse github tree source.")

        new_trees = [
            source_tree_url + "/" + el["path"]
            for el in tree_elements
            if el["contentType"] == "directory"
        ]

        acc += [
            el["path"].replace("llama-index-packs/", "/")
            for el in tree_elements
            if el["contentType"] == "file"
        ]

        return recursive_tree_traverse(
            tree_urls=tree_urls[1:] + new_trees,
            acc=acc,
            source_tree_url=source_tree_url,
        )
Recursively traversge Github trees to get all file paths in a folder.
llama-index-core/llama_index/core/download/utils.py