Skip to content

Slow indexing of folder tree #200

Open
@RichieHakim

Description

@RichieHakim

Using the iPython OSF object, it is very slow to walk through a tree structure of folders in order to index the data repo.

import osfclient
client = osfclient.OSF()
proj = client.project('url_id')

def build_folder_tree(folder):
    subfolders = list(folder.folders)
    tree = {}
    for sub in subfolders:
        tree_sub = build_folder_tree(sub)
        tree[sub.name] = tree_sub
    if tree == {}:
        tree = (f for f in folder.files)
    return tree

tree = build_folder_tree(proj.storage())

Is there an easier way to build a hierarchical index of a project repo so that one can quickly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions