fileutil

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(wd, path string) (string, error)

Abs is similar to filepath.Abs but it allows you to pass a custom wd

func CP

func CP(wd string, paths ...string) (err error)

func CommonFilepathPrefix

func CommonFilepathPrefix(paths []string) string

func CopyDirectory

func CopyDirectory(scrDir, dest string) error

copy directory will copy all of the contents of one directory into another directory

func CopyFile

func CopyFile(srcFile, dstFile string) error

func CopyFilesByPath

func CopyFilesByPath(prefix string, files []string, dest string) (err error)

CopyFiles takes a list of absolute paths to files and copies them into another directory, maintaining structure. Importantly it doesn't copy all the files in these directories, just the specific named paths.

func CopySymLink(source, dest string) error

func CreateDirIfNotExists

func CreateDirIfNotExists(dir string, perm os.FileMode) error

func DirExists

func DirExists(path string) bool

DirExists will only return true if the path exists and is a directory

func FileExists

func FileExists(path string) bool

FileExists will only return true if the path is a file, not a directory

func FindExecutable

func FindExecutable(file string) error

func IsDir

func IsDir(file string) bool

func LookPath

func LookPath(file string, path string) (string, error)

func PathExists

func PathExists(path string) bool

func PathWithinDir

func PathWithinDir(dir, path string) (err error)

PathWithinDir checks if a path is within a given directory. It doesn't validate if the passed directory path is actually a directory. If the function returns a nil error the path is within the directory.

Dir and path must be absolute paths

func ReplaceAll

func ReplaceAll(filepath, old, new string) (err error)

func ValidSymlinkExists

func ValidSymlinkExists(path string) (dest string, ok bool)

Types

This section is empty.

Jump to

Keyboard shortcuts

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