fs

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirsExist

func DirsExist(paths []string) error

DirsExist runs DirExists for multiple paths.

func FileExists

func FileExists(path string) bool

FileExists returns true if path exist and is a file

func FileReadLine

func FileReadLine(path string) (string, error)

FileReadLine reads the first line from a file

func FileSize

func FileSize(path string) (int64, error)

FileSize returns the size of a file in Bytes

func FindAllDirs

func FindAllDirs(path string) ([]string, error)

FindAllDirs returns recursively all diretories in path, including the passed path dir

func FindFileInParentDirs

func FindFileInParentDirs(startPath, filename string) (string, error)

FindFileInParentDirs finds a directory that contains filename. The function starts searching in startPath and then checks recursively each parent directory for the file. It returns the absolute path to the first found directory contains the file. If it reaches the root directory without finding the file it returns os.ErrNotExist

func FindFilesInSubDir

func FindFilesInSubDir(searchDir, filename string, maxdepth int) ([]string, error)

FindFilesInSubDir returns all directories that contain filename that are in searchDir. The function descends up to maxdepth levels of directories below searchDir

func Glob

func Glob(path string) ([]string, error)

Glob is similar then filepath.Glob() but also support '**' to match files and directories recursively and only returns paths to Files. If a Glob doesn't match any files an empty []string is returned and error is nil

func IsDir

func IsDir(path string) (bool, error)

IsDir returns true if the path is a directory.

func IsFile

func IsFile(path string) (bool, error)

IsFile returns true if path is a file. If the path does not exist an error is returned

func PathsJoin

func PathsJoin(rootPath string, relPaths []string) []string

PathsJoin returns a list where all paths in relPaths are prefixed with rootPath

Types

This section is empty.

Jump to

Keyboard shortcuts

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