MCPcopy Create free account
hub / github.com/gokcehan/lf / copySize

Function copySize

copy.go:33–55  ·  view source on GitHub ↗
(srcs []string)

Source from the content-addressed store, hash-verified

31}
32
33func copySize(srcs []string) (int64, error) {
34 var total int64
35
36 for _, src := range srcs {
37 _, err := os.Lstat(src)
38 if os.IsNotExist(err) {
39 return total, fmt.Errorf("src does not exist: %q", src)
40 }
41
42 err = filepath.Walk(src, func(_ string, info os.FileInfo, err error) error {
43 if err != nil {
44 return fmt.Errorf("walk: %w", err)
45 }
46 total += info.Size()
47 return nil
48 })
49 if err != nil {
50 return total, err
51 }
52 }
53
54 return total, nil
55}
56
57func copyFile(src, dst string, preserve []string, info os.FileInfo, nums chan<- int64, errs chan<- error) {
58 r, err := os.Open(src)

Callers 3

copyAsyncMethod · 0.85
moveAsyncMethod · 0.85
calcDirSizeMethod · 0.85

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected