diff --git a/fs/operations/operations.go b/fs/operations/operations.go index d2220cc42..88daa6c91 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -546,7 +546,11 @@ func SuffixName(ctx context.Context, remote string) string { // and accumulating stats and errors. // // If backupDir is set then it moves the file to there instead of -// deleting +// deleting. +// +// Use BackupDir to find backupDir from --backup-dir. That lookup is +// relatively expensive, so when deleting many files do it once outside +// the loop rather than calling it for every object. func DeleteFileWithBackupDir(ctx context.Context, dst fs.Object, backupDir fs.Fs) (err error) { tr := accounting.Stats(ctx).NewCheckingTransfer(dst, "deleting") defer func() { @@ -579,8 +583,8 @@ func DeleteFileWithBackupDir(ctx context.Context, dst fs.Object, backupDir fs.Fs // DeleteFile deletes a single file respecting --dry-run and accumulating stats and errors. // -// If useBackupDir is set and --backup-dir is in effect then it moves -// the file to there instead of deleting +// DeleteFile does not honour --backup-dir: it always deletes. Call +// DeleteFileWithBackupDir instead if --backup-dir support is required. func DeleteFile(ctx context.Context, dst fs.Object) (err error) { return DeleteFileWithBackupDir(ctx, dst, nil) }