forked from TrueCloudLab/rclone
copy/sync: only create empty directories when they don't exist on the remote
Sync/copy now only creates empty directories when they don't exist on the remote (--create-empty-src-dirs flag) - fixes #2800
This commit is contained in:
parent
1c800efbac
commit
0c6f14c694
1 changed files with 9 additions and 5 deletions
|
@ -879,11 +879,15 @@ func (s *syncCopyMove) Match(ctx context.Context, dst, src fs.DirEntry) (recurse
|
||||||
// Do the same thing to the entire contents of the directory
|
// Do the same thing to the entire contents of the directory
|
||||||
_, ok := dst.(fs.Directory)
|
_, ok := dst.(fs.Directory)
|
||||||
if ok {
|
if ok {
|
||||||
|
// Only record matched (src & dst) empty dirs when performing move
|
||||||
|
if s.DoMove {
|
||||||
// Record the src directory for deletion
|
// Record the src directory for deletion
|
||||||
s.srcEmptyDirsMu.Lock()
|
s.srcEmptyDirsMu.Lock()
|
||||||
s.srcParentDirCheck(src)
|
s.srcParentDirCheck(src)
|
||||||
s.srcEmptyDirs[src.Remote()] = src
|
s.srcEmptyDirs[src.Remote()] = src
|
||||||
s.srcEmptyDirsMu.Unlock()
|
s.srcEmptyDirsMu.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// FIXME src is dir, dst is file
|
// FIXME src is dir, dst is file
|
||||||
|
|
Loading…
Reference in a new issue