Back to godoc.org
github.com/rclone/rclone/fs/dirtree

package dirtree

v1.52.2
Latest Go to latest
Published: Jun 24, 2020 | License: MIT | Module: github.com/rclone/rclone

Overview

Package dirtree contains the DirTree type which is used for building filesystem heirachies in memory.

Index

type DirTree

type DirTree map[string]fs.DirEntries

DirTree is a map of directories to entries

func New

func New() DirTree

New returns a fresh DirTree

func (DirTree) Add

func (dt DirTree) Add(entry fs.DirEntry)

Add an entry to the tree it doesn't create parents

func (DirTree) AddDir

func (dt DirTree) AddDir(entry fs.DirEntry)

AddDir adds a directory entry to the tree this creates the directory itself if required it doesn't create parents

func (DirTree) AddEntry

func (dt DirTree) AddEntry(entry fs.DirEntry)

AddEntry adds the entry and creates the parents for it regardless of whether it is a file or a directory.

func (DirTree) CheckParent

func (dt DirTree) CheckParent(root, dirPath string)

CheckParent checks that dirPath has a *Dir in its parent

func (DirTree) CheckParents

func (dt DirTree) CheckParents(root string)

CheckParents checks every directory in the tree has *Dir in its parent

func (DirTree) Dirs

func (dt DirTree) Dirs() (dirNames []string)

Dirs returns the directories in sorted order

func (DirTree) Find

func (dt DirTree) Find(filePath string) (parentPath string, entry fs.DirEntry)

Find returns the DirEntry for filePath or nil if not found

func (DirTree) Prune

func (dt DirTree) Prune(dirNames map[string]bool) error

Prune remove directories from a directory tree. dirNames contains all directories to remove as keys, with true as values. dirNames will be modified in the function.

func (DirTree) Sort

func (dt DirTree) Sort()

Sort sorts all the Entries

func (DirTree) String

func (dt DirTree) String() string

String emits a simple representation of the DirTree

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier