mirror of https://github.com/rclone/rclone.git
sync: copy dir modtimes even when copyEmptySrcDirs is false - fixes #8317
Before, after a sync, only file modtimes were updated when not using --copy-empty-src-dirs. This ensures modtimes are updated to match the source folder, regardless of copyEmptySrcDir. The flag --no-update-dir-modtime (which previously did nothing) will disable this.
This commit is contained in:
parent
2ff8aa1c20
commit
c1b414e2cf
|
@ -1109,23 +1109,17 @@ func (s *syncCopyMove) copyDirMetadata(ctx context.Context, f fs.Fs, dst fs.Dire
|
|||
if !s.setDirModTimeAfter && equal {
|
||||
return nil
|
||||
}
|
||||
if s.setDirModTimeAfter && equal {
|
||||
newDst = dst
|
||||
} else if s.copyEmptySrcDirs {
|
||||
if s.setDirMetadata {
|
||||
if !equal {
|
||||
if s.setDirMetadata && s.copyEmptySrcDirs {
|
||||
newDst, err = operations.CopyDirMetadata(ctx, f, dst, dir, src)
|
||||
} else if s.setDirModTime {
|
||||
if dst == nil {
|
||||
} else if dst == nil && s.setDirModTime && s.copyEmptySrcDirs {
|
||||
newDst, err = operations.MkdirModTime(ctx, f, dir, src.ModTime(ctx))
|
||||
} else {
|
||||
} else if dst == nil && s.copyEmptySrcDirs {
|
||||
err = operations.Mkdir(ctx, f, dir)
|
||||
} else if dst != nil && s.setDirModTime {
|
||||
newDst, err = operations.SetDirModTime(ctx, f, dst, dir, src.ModTime(ctx))
|
||||
}
|
||||
} else if dst == nil {
|
||||
// Create the directory if it doesn't exist
|
||||
err = operations.Mkdir(ctx, f, dir)
|
||||
}
|
||||
} else {
|
||||
newDst = dst
|
||||
}
|
||||
// If we need to set modtime after and we created a dir, then save it for later
|
||||
if s.setDirModTime && s.setDirModTimeAfter && err == nil {
|
||||
|
|
Loading…
Reference in New Issue