Documentation ¶
Index ¶
- func Exists(pth string) (bool, error)
- func IsDir(pth string) (bool, error)
- func IsRegular(pth string) (bool, error)
- func RemoveDir(pth string) error
- func RemoveDirAll(pth string) error
- func RemoveFile(pth string) error
- func SearchDir(base string, target string) (pth string, err error)
- func SearchDirs(baseDirs string, target string) (pth string, err error)
- func SearchRecursive(root string, target string) (pth string, err error)
- func Walk(root string) (<-chan string, <-chan error, chan<- struct{})
- type WalkError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveDir ¶
RemoveDir attempts to remove the directory at the given path. This will fail if the directory is non-empty.
func RemoveDirAll ¶
RemoveDirAll attempts to remove the directory at the given path, along with the contents of the directory.
func RemoveFile ¶
RemoveFile attempts to remove the file at the given path.
func SearchDir ¶
SearchDir non-recursively searches the given base directory for the target file or directory. Upon success, returns the path to the target (including base).
func SearchDirs ¶
SearchDirs will non-recursively search the colon-separated list of directories for the first occurrence of the target file or directory. Upon success, returns the path to the target (including base). Will silently ignore any base directories that do not exist or are unreadable due to insufficient permissions.
func SearchRecursive ¶
SearchRecursive recursively walks the file tree rooted at root. Any directories for which we do not have permission to read will be skipped. Symbolic links will not be followed. It will return the path (including the root) for the first file or directory matching "target". If no match is found, then returns the empty string.
func Walk ¶
Walk recursively walks the file tree rooted at root. The paths to the regular files encountered (the root is included in the path) are passed down the first channel. Any directories for which we do not have permission to read will be skipped. Symbolic links will not be followed. Any errors encountered during the walk will be passed down the second channel (of type *WalkError), and the walk will continue. The third return value is a channel that can be closed to halt the walk.