Skip to content

cp is a Go utitliy for copying directories and files.

Notifications You must be signed in to change notification settings

JackMordaunt/go-cp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cp

Package cp is a tiny utility. It exposes a type that can easily copy one file directory into another, somewhat analogous to the cp unix command.

In natural Go fashion the files are copied concurrently to maximise throughput.

The Copier can be used as-is.

You can plugin any file system you want using the github.com/spf13/afero.Fs interface. The OS filesystem object is the default.

Usage

func main() {
	args := os.Args[1:]
	if len(args) < 2 {
		oops("not enough arguments\n")
	}
	from, to := args[0], args[1]
	copier := cp.Copier{
		Clobber: true,
	}
	if err := copier.Copy(from, to); err != nil {
		fatal("copying files: %v\n", err)
	}
}

About

cp is a Go utitliy for copying directories and files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages