copy

package module
v1.0.3-0...-8aa448c Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

copy

Build Status codecov GoDoc Go Report Card

copy copies directories recursively.

Example:

err := Copy("your/directory", "your/directory.copy")

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// If set to true, unsupported file types will not be copied, and no error will be generated
	IgnoreUnsupportedFileTypes = false
	// If set to true, the permission of the source files and folder will be preserved in the destination
	PreservePermissions = false
	// If set to true, the owner of the source files and folder will be preserved in the destination
	PreserveOwner = false
	// If set to true, the access and modifications times of the source files and folder will be preserved in the destination
	PreserveTime = false
)
View Source
var FileTypeCopyHandlers = map[os.FileMode]FileCopyHandler{
	os.ModeSymlink: lcopy,
}

Functions

func Copy

func Copy(src, dest string) error

Copy copies src to dest, doesn't matter if src is a directory or a file

Example
err := Copy("testdata/example", "testdata.copy/example")
fmt.Println("Error:", err)
info, _ := os.Stat("testdata.copy/example")
fmt.Println("IsDir:", info.IsDir())
Output:
Error: <nil>
IsDir: true

Types

type FileCopyHandler

type FileCopyHandler func(src, dest string, info os.FileInfo) error

type FileCopyTasksError

type FileCopyTasksError struct {
	// contains filtered or unexported fields
}

func (*FileCopyTasksError) Error

func (e *FileCopyTasksError) Error() string

type UnsupportedFileTypeError

type UnsupportedFileTypeError struct {
	// contains filtered or unexported fields
}

func (*UnsupportedFileTypeError) Error

func (e *UnsupportedFileTypeError) Error() string

Jump to

Keyboard shortcuts

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