operations: display 'Deleted X extra copies' only if dedupe successful - fixes #3551

This commit is contained in:
SezalAgrawal 2019-10-08 21:05:53 +05:30 committed by Nick Craig-Wood
parent 5c2dfeee46
commit 7712b780ba
1 changed files with 8 additions and 2 deletions

View File

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