Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • F file-tree
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Michiel Cottaar
  • file-tree
  • Issues
  • #2
Closed
Open
Issue created Oct 18, 2021 by Evan Edmond@edmondContributor

request for functionality - convert/symlink dataset in one filetree format to another

Would there be any interest in adding a function like this to the FileTree class? I've found it useful for converting multiple datasets in different formats to a common format.

Cheers,

Evan

def convert(src_tree, new_tree, keys, symlink=True):
    for k in keys:
        src_tree.update_glob(k, inplace=True)
        for subtree in src_tree.iter(k):
            src_file = subtree.get(k)
            src_vars = subtree.placeholders
            dest_file = new_tree.update(inplace=True, **src_vars).get(k, make_dir=True)
            if symlink:
                os.symlink(src_file, dest_file)
            else:
                copy2(src_file, dest_file)
Assignee
Assign to
Time tracking