MCPcopy Index your code
hub / github.com/perkeep/perkeep / cpDir

Function cpDir

dev/devcam/devcam.go:75–94  ·  view source on GitHub ↗

cpDir copies the contents of src dir into dst dir. filter is a list of file suffixes to skip. ex: ".go"

(src, dst string, filter []string)

Source from the content-addressed store, hash-verified

73// cpDir copies the contents of src dir into dst dir.
74// filter is a list of file suffixes to skip. ex: ".go"
75func cpDir(src, dst string, filter []string) error {
76 return filepath.Walk(src, func(fullpath string, fi os.FileInfo, err error) error {
77 if err != nil {
78 return err
79 }
80 for _, suffix := range filter {
81 if strings.HasSuffix(fi.Name(), suffix) {
82 return nil
83 }
84 }
85 suffix, err := filepath.Rel(src, fullpath)
86 if err != nil {
87 return fmt.Errorf("Failed to find Rel(%q, %q): %v", src, fullpath, err)
88 }
89 if fi.IsDir() {
90 return nil
91 }
92 return cpFile(fullpath, filepath.Join(dst, suffix))
93 })
94}
95
96func cpFile(src, dst string) error {
97 sfi, err := os.Stat(src)

Callers 1

syncTemplateBlobsMethod · 0.70

Calls 4

cpFileFunction · 0.70
NameMethod · 0.65
IsDirMethod · 0.65
WalkMethod · 0.45

Tested by

no test coverage detected