filepathy

package
v0.1.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Walk

func Walk(root string, c WalkConfig, walkFn func(path string, info os.FileInfo, err error) error) error

Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, given the contents of WalkConfig. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient. Walk does not follow symbolic links.

Types

type WalkConfig

type WalkConfig struct {
	// Dirs controls whether to call walkFn for directories
	Dirs bool

	// Files controls whether to call walkFn for files
	Files bool

	// Extensions is a whitelist to filter files (not dirs) by, meaning that
	// walkFn is only called for the given extensions. When Extensions is empty,
	// nothing is filtered.
	Extensions []string

	// Whether to recurse through directories
	Recursive bool

	// Root controls whether to call walkFn for the root directory
	Root bool
}

WalkConfig controls when walkFn is called by Walk.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL