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

dedup: add warning if used on a remote which can't have duplicate names

Nick Craig-Wood3e986cdf54e3
diff --git a/cmd/dedupe/dedupe.go b/cmd/dedupe/dedupe.go
index 7d5e0767c..d45bea01a 100644
--- a/cmd/dedupe/dedupe.go
+++ b/cmd/dedupe/dedupe.go
@@ -5,6 +5,7 @@ import (
"log"
"github.com/rclone/rclone/cmd"
+ "github.com/rclone/rclone/fs"
"github.com/rclone/rclone/fs/config/flags"
"github.com/rclone/rclone/fs/operations"
"github.com/spf13/cobra"
@@ -143,6 +144,9 @@ Or
args = args[1:]
}
fdst := cmd.NewFsSrc(args)
+ if !byHash && !fdst.Features().DuplicateFiles {
+ fs.Logf(fdst, "Can't have duplicate names here. Perhaps you wanted --by-hash ? Continuing anyway.")
+ }
cmd.Run(false, false, command, func() error {
return operations.Deduplicate(context.Background(), fdst, dedupeMode, byHash)
})