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

This commit is contained in:
Nick Craig-Wood 2021-01-22 15:25:35 +00:00
parent b80d498304
commit 3e986cdf54
1 changed files with 4 additions and 0 deletions

View File

@ -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)
})