fileutil

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src, dst string, buf []byte, perm os.FileMode, ignoreType os.FileMode) error

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist.

func CopyFile

func CopyFile(src, dst string, buf []byte, perm os.FileMode) error

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode is set to perm and the copied data is synced/flushed to stable storage.

func RemoveDirs added in v0.1.2

func RemoveDirs(dir string) error

Always returns non-nil error which is the last error of os.Remove(dir)

func TryLinkDir added in v0.2.0

func TryLinkDir(src, dst string, buf []byte, perm os.FileMode, ignoreType os.FileMode) error

TryLinkDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist.

func TryLinkFile added in v0.2.0

func TryLinkFile(src, dst string, buf []byte, perm os.FileMode) error

TryLinkFile tries os.Link() at first, but if it failed call CopyFile to copy the contents of src to dst

Types

type InvalidTypeError added in v0.2.0

type InvalidTypeError struct {
	Filename string
}

func (*InvalidTypeError) Error added in v0.2.0

func (e *InvalidTypeError) Error() string

Jump to

Keyboard shortcuts

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