pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/rclone/rclone/pull/9415

3ac04bb.css" /> operations: fix DeleteFile/DeleteFiles to respect --backup-dir by superShen0916 · Pull Request #9415 · rclone/rclone · GitHub
Skip to content

operations: fix DeleteFile/DeleteFiles to respect --backup-dir#9415

Open
superShen0916 wants to merge 1 commit into
rclone:masterfrom
superShen0916:fix/deletefile-backup-dir
Open

operations: fix DeleteFile/DeleteFiles to respect --backup-dir#9415
superShen0916 wants to merge 1 commit into
rclone:masterfrom
superShen0916:fix/deletefile-backup-dir

Conversation

@superShen0916
Copy link
Copy Markdown

@superShen0916 superShen0916 commented May 10, 2026

Summary

Fixes #7566 - DeleteFile and DeleteFiles now actually respect the --backup-dir flag instead of always passing nil.

Before: Both functions always deleted files regardless of --backup-dir:

func DeleteFile(ctx context.Context, dst fs.Object) (err error) {
    return DeleteFileWithBackupDir(ctx, dst, nil)
}

After: Both functions check --backup-dir config and move files to the backup directory when configured:

func DeleteFile(ctx context.Context, dst fs.Object) (err error) {
    ci := fs.GetConfig(ctx)
    var backupDir fs.Fs
    if ci.BackupDir != "" {
        backupDir, err = cache.Get(ctx, ci.BackupDir)
        ...
    }
    return DeleteFileWithBackupDir(ctx, dst, backupDir)
}

Changes

  • fs/operations/operations.go: Updated DeleteFile and DeleteFiles to look up --backup-dir from config and pass it to the underlying DeleteFileWithBackupDir / DeleteFilesWithBackupDir functions

Test plan

  • go build ./fs/operations/ succeeds

DeleteFile and DeleteFiles previously always passed nil as the
backupDir parameter, meaning --backup-dir was never used when
deleting files. This was contrary to the comment on DeleteFile
which stated that --backup-dir would be respected.

Fix both functions to check the configured --backup-dir and pass
it through to the underlying WithBackupDir variants.

Fixes rclone#7566

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: shenpeng.sp0916 <shenpeng.sp0916@bytedance.com>
@superShen0916 superShen0916 force-pushed the fix/deletefile-backup-dir branch from 7871382 to bf25dba Compare May 10, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

operations.DeleteFile does not use --backup-dir, despite comment

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy