Documentation
¶
Overview ¶
Package fscopy implements portable filesystem copy operations for Timoni modules stored on the local filesystem.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrSymlinkCycle is returned when following symlinks // leads back to a directory currently being copied. ErrSymlinkCycle = errors.New("symlink cycle detected") // ErrTooManyEntries is returned when a copy exceeds // the maximum number of filesystem entries. ErrTooManyEntries = errors.New("too many filesystem entries") )
Functions ¶
func CopyDir ¶
CopyDir recursively copies the contents of srcDir into dstDir, creating dstDir if needed. Permission bits are preserved, while setuid, setgid and sticky bits are deliberately dropped, and timestamps are not kept. Entries that are neither regular files, directories, nor symlinks (sockets, pipes, devices) are skipped. Symlink handling is controlled by opts.FollowSymlinks. All writes are confined to dstDir: symlinks already present under the destination cannot redirect them elsewhere.
Types ¶
type Options ¶
type Options struct {
// FollowSymlinks resolves symbolic links and copies their targets
// as regular files and directories. Cycles are detected and reported
// as ErrSymlinkCycle, and dangling links fail the copy.
// When false (the default), symlinks are skipped.
FollowSymlinks bool
// Skip is called before copying each entry with the source path and
// whether the entry is a directory. Returning true excludes the entry,
// and for directories, everything under it, without reading it.
// The path is always the logical location under the source root, even
// for content materialized from symlink targets living elsewhere.
// A symlink is first reported with isDir set to false; when following
// symlinks and the target is a directory, Skip is consulted again with
// isDir set to true before the directory is copied.
Skip func(src string, isDir bool) bool
// MaxEntries caps the total number of copied entries.
// Zero applies a default of about one million.
MaxEntries int
}
Options configures the CopyDir operation.
Click to show internal directories.
Click to hide internal directories.