copydir

package
v0.13.7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(dst, src string) error

CopyDir recursively copies all of the files within the directory given in src to the directory given in dst.

Both directories should already exist. If the destination directory is non-empty then the new files will merge in with the old, overwriting any files that have a relative path in common between source and destination.

Recursive copying of directories is inevitably a rather opinionated sort of operation, so this function won't be appropriate for all use-cases. Some of the "opinions" it has are described in the following paragraphs:

Symlinks in the source directory are recreated with the same target in the destination directory. If the symlink is to a directory itself, that directory is not recursively visited for further copying.

File and directory modes are not preserved exactly, but the executable flag is preserved for files on operating systems where it is significant.

Any "dot files" it encounters along the way are skipped, even on platforms that do not normally ascribe special meaning to files with names starting with dots.

Callers may rely on the above details and other undocumented details of this function, so if you intend to change it be sure to review the callers first and make sure they are compatible with the change you intend to make.

func SameFile

func SameFile(a, b string) (bool, error)

SameFile returns true if the two given paths refer to the same physical file on disk, using the unique file identifiers from the underlying operating system. For example, on Unix systems this checks whether the two files are on the same device and have the same inode.

Types

This section is empty.

Jump to

Keyboard shortcuts

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