Documentation
¶
Overview ¶
walk walks one or more root paths concurrently and sends the results back via a channel. It wraps path/filepath.Walk() for people who don't want to think too much about symlinks, recursion, hidden file handling, etc.
Index ¶
Constants ¶
const ( Defaults = 0 // TODO: SeeRootLinks = 1 // default: if root paths are symlinks they will be ignored // TODO: SeeLinks = 2 // default: all symlinks (except root links) will be ignored // TODO: FollowLinks = 4 // default: returns 'seen' symlinks as symlinks instead of following links // TODO: SeeDotFiles = 8 // default: ignores '.' and '..' dir entries TODO HiddenDirs = 16 // default: won't descend into folders starting with '.' HiddenFiles = 32 // default: won't return files starting with '.' ReturnDirs = 64 // default: doesn't return dir paths (note: never returns root dirs) NoRecurse = 128 // default: walks subdirs recursively )
Option flags for walking; add to options to change default behaviour
Variables ¶
This section is empty.
Functions ¶
func FileCh ¶
FileCh returns a file channel and walks (concurrently) all paths under each root folder in []roots, sending all regular files encountered to the channel, which is closed once all walks have completed. Walking the same file or folder twice is avoided, so for example
ch := FileCh(d, e, {"/foo", "/foo/bar"}, true)
will only walk the files in /foo/bar once. Errors are returned via the optional caller-supplied error channel. If hidden is false then hidden files and folders are ignored, unless they are members of []roots. If done is closed, FileCh() aborts the walk(s) and closes the file channel.