dirsearch.mod

module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: MIT

README

dirsearch

Some useful functions for searching directories and returning useful information.

The information returned is a map of pathnames to os.FileInfo and a slice of errors detected while scanning the directory

There are functions for

  • finding files in a single directory
  • finding files in a directory and all its subdirectories
  • finding files in a directory and those of its subdirectories that pass directory-specific tests

All of these functions allow you to pass additional checks on the entries to restrict the results returned. You do this by passing additional arguments which are check.FileInfo funcs. The simplest example of how you might use the functions is:

	results, errs := dirsearch.Find("/tmp")

This will return a map containing all the entries in the /tmp directory.

Alternatively you could find just the hidden files in your home directory with:

	results, errs := dirsearch.Find(os.Getenv("HOME"),
		check.FileInfoName(check.StringHasPrefix(".")))

See the go documentation for more examples.

Directories

Path Synopsis
Package dirsearch offers some useful functions for searching directories and returning useful information.
Package dirsearch offers some useful functions for searching directories and returning useful information.

Jump to

Keyboard shortcuts

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