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: state whether duplicates are objects are directories

Nick Craig-Wood72add5ab27b3
diff --git a/fs/operations.go b/fs/operations.go
index ebbfe1ed6..045728525 100644
--- a/fs/operations.go
+++ b/fs/operations.go
@@ -590,6 +590,18 @@ func (ds DirEntries) ForDirError(fn func(dir Directory) error) error {
return nil
}
+// DirEntryType returns a string description of the DirEntry, either
+// "object", "directory" or "unknown type XXX"
+func DirEntryType(d DirEntry) string {
+ switch d.(type) {
+ case Object:
+ return "object"
+ case Directory:
+ return "directory"
+ }
+ return fmt.Sprintf("unknown type %T", d)
+}
+
// ListDirSorted reads Object and *Dir into entries for the given Fs.
//
// dir is the start directory, "" for root
diff --git a/fs/sync.go b/fs/sync.go
index bbd6a442b..601d948f4 100644
--- a/fs/sync.go
+++ b/fs/sync.go
@@ -866,7 +866,7 @@ func matchListings(srcList, dstList DirEntries) (srcOnly DirEntries, dstOnly Dir
if src != nil && iSrc > 0 {
prev := srcList[iSrc-1].Remote()
if srcRemote == prev {
- Logf(src, "Duplicate file found in source - ignoring")
+ Logf(src, "Duplicate %s found in source - ignoring", DirEntryType(src))
src = nil // ignore the src
} else if srcRemote < prev {
Errorf(src, "Out of order listing in source")
@@ -876,7 +876,7 @@ func matchListings(srcList, dstList DirEntries) (srcOnly DirEntries, dstOnly Dir
if dst != nil && iDst > 0 {
prev := dstList[iDst-1].Remote()
if dstRemote == prev {
- Logf(dst, "Duplicate file found in destination - ignoring")
+ Logf(dst, "Duplicate %s found in destination - ignoring", DirEntryType(dst))
dst = nil // ignore the dst
} else if dstRemote < prev {
Errorf(dst, "Out of order listing in destination")