Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

sync: remove now superfluous copyEmptyDirectories function

nielash0bfd70c40548
diff --git a/fs/sync/sync.go b/fs/sync/sync.go
index 5d0bee896..0d1cfc6e6 100644
--- a/fs/sync/sync.go
+++ b/fs/sync/sync.go
@@ -696,38 +696,6 @@ func (s *syncCopyMove) deleteEmptyDirectories(ctx context.Context, f fs.Fs, entr
return nil
}
-// This copies the empty directories in the slice passed in and logs
-// any errors copying the directories
-func copyEmptyDirectories(ctx context.Context, f fs.Fs, entries map[string]fs.DirEntry) error {
- if len(entries) == 0 {
- return nil
- }
-
- var okCount int
- for _, entry := range entries {
- dir, ok := entry.(fs.Directory)
- if ok {
- err := operations.Mkdir(ctx, f, dir.Remote())
- if err != nil {
- fs.Errorf(fs.LogDirName(f, dir.Remote()), "Failed to Mkdir: %v", err)
- } else {
- okCount++
- }
- } else {
- fs.Errorf(f, "Not a directory: %v", entry)
- }
- }
-
- if accounting.Stats(ctx).Errored() {
- fs.Debugf(f, "failed to copy %d directories", accounting.Stats(ctx).GetErrors())
- }
-
- if okCount > 0 {
- fs.Debugf(f, "copied %d directories", okCount)
- }
- return nil
-}
-
// mark the parent of entry as not empty and if entry is a directory mark it as potentially empty.
func (s *syncCopyMove) markParentNotEmpty(entry fs.DirEntry) {
s.srcEmptyDirsMu.Lock()
@@ -1006,10 +974,6 @@ func (s *syncCopyMove) run() error {
s.stopTransfers()
s.stopDeleters()
- if s.copyEmptySrcDirs {
- s.processError(copyEmptyDirectories(s.ctx, s.fdst, s.srcEmptyDirs))
- }
-
// Delete files after
if s.deleteMode == fs.DeleteModeAfter {
if s.currentError() != nil && !s.ci.IgnoreErrors {