MCPcopy Create free account
hub / github.com/celer-pkg/celer / CopyDir

Function CopyDir

pkgs/fileio/file.go:86–104  ·  view source on GitHub ↗

CopyDir copy files in src to dest.

(srcDir, dstDir string)

Source from the content-addressed store, hash-verified

84
85// CopyDir copy files in src to dest.
86func CopyDir(srcDir, dstDir string) error {
87 return filepath.Walk(srcDir, func(srcPath string, info os.FileInfo, err error) error {
88 if err != nil {
89 return err
90 }
91
92 relPath, err := filepath.Rel(srcDir, srcPath)
93 if err != nil {
94 return err
95 }
96 dstPath := filepath.Join(dstDir, relPath)
97
98 if info.IsDir() {
99 return os.MkdirAll(dstPath, info.Mode())
100 }
101
102 return CopyFile(srcPath, dstPath)
103 })
104}
105
106// RenameDir rename files in src to dest.
107func RenameDir(srcDir, dstDir string) error {

Callers 2

InstallMethod · 0.92
InstallMethod · 0.92

Calls 2

CopyFileFunction · 0.85
MkdirAllMethod · 0.80

Tested by

no test coverage detected