From 7712b780bad9b544d228f9d9fd5cd1e0d0f4477e Mon Sep 17 00:00:00 2001 From: SezalAgrawal Date: Tue, 8 Oct 2019 21:05:53 +0530 Subject: [PATCH] operations: display 'Deleted X extra copies' only if dedupe successful - fixes #3551 --- fs/operations/dedupe.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/operations/dedupe.go b/fs/operations/dedupe.go index 6ab09b57e..2ee706312 100644 --- a/fs/operations/dedupe.go +++ b/fs/operations/dedupe.go @@ -61,13 +61,19 @@ outer: // dedupeDeleteAllButOne deletes all but the one in keep func dedupeDeleteAllButOne(ctx context.Context, keep int, remote string, objs []fs.Object) { + count := 0 for i, o := range objs { if i == keep { continue } - _ = DeleteFile(ctx, o) + err := DeleteFile(ctx, o) + if err == nil { + count++ + } + } + if count > 0 { + fs.Logf(remote, "Deleted %d extra copies", count) } - fs.Logf(remote, "Deleted %d extra copies", len(objs)-1) } // dedupeDeleteIdentical deletes all but one of identical (by hash) copies