Apply preserve mode for directories (#1981)

This commit is contained in:
Joe Lim authored and GitHub committed 2025-05-11 10:40:20 +10:00
1 parent 84c57cc58a
commit 62cbe0b6b5
1 file changed
+5 -1
+5 -1
View File
@@ -133,7 +133,11 @@ func copyAll(srcs []string, dstDir string, preserve []string) (nums chan int64,
newPath := filepath.Join(dst, rel)
switch {
case info.IsDir():
if err := os.MkdirAll(newPath, info.Mode()); err != nil {
var dst_mode os.FileMode = os.ModePerm
if slices.Contains(preserve, "mode") {
dst_mode = info.Mode()
}
if err := os.MkdirAll(newPath, dst_mode); err != nil {
errs <- fmt.Errorf("mkdir: %s", err)
}
if slices.Contains(preserve, "timestamps") {