fs

package module
v0.0.0-...-ac39b8e Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: Apache-2.0 Imports: 14 Imported by: 5

README

FS

Build Status GoDoc

FS is a file system toolkit for the Go programming language.

Getting Started

Install the package, along with executable binary helper (go 1.4 and greater is required):

$ go get -v github.com/goanywhere/fs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(path string) string

Abs finds the absolute path for the given path. Supported Formats:

  • empty path => current working directory.
  • '.', '..' & '~'

*NOTE* Abs does NOT check the existence of the path.

func Copy

func Copy(src, dst string) (err error)

Copy recursively copies files/(sub)directoires into the given path. *NOTE* It uses platform's native copy commands (windows: copy, *nix: rsync).

func Exists

func Exists(path string) bool

Exists check if the given path exists.

func Find

func Find(root string, pattern *regexp.Regexp) (paths []string)

Find matches files with regular expression pattern under the given root.

func Getcd

func Getcd(skip int) string

Getcd returns absolute path of the caller.

func Geted

func Geted() string

Geted returns an absolute path to the executable.

func Getwd

func Getwd() string

Getwd returns a absolute path of the current directory.

func Glob

func Glob(path string, pattern string) (matches []string, err error)

Glob recursively finds the names of all files matching pattern under the given path.

func Grep

func Grep(root string, pattern *regexp.Regexp) (paths []string)

Grep searches text files via regular expression under the given path, paths of the files contain matched line(s) will be returned.

func IsDir

func IsDir(path string) bool

IsDir checks if the given path is a directory.

func IsFile

func IsFile(path string) bool

IsFile checks if the given path is a file.

func NewWatcher

func NewWatcher(dir string) *watcher

func UserDir

func UserDir() string

UserDir finds base path of current system user.

Types

This section is empty.

Jump to

Keyboard shortcuts

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