B2: delete files during sync and without cleanup?

Am loving rclone so far!

I’ve found the need to occasionally delete a large number of files in a b2 bucket via rclone sync.

What I’ve noticed is that rclone will simply mark these files as hidden instead of deleting them. I need to then separately run rclone cleanup to purge these hidden files in order to reduce the bucket size. That operation seems to cost a lot of Class C transactions: I empirically observed over 100 transactions when deleting ~7,000 files.

The now closed GitHub issue #462 talked about ensuring versions are not kept when overwriting files during sync but the cleanup command was implemented in its favor.

I see a benefit to an opt-in for automatically deleting files during sync:

  • We can minimize bucket disk space (and cost) if there are large additions to the bucket during sync because we don’t have to wait until the sync completes to recover the space with a cleanup.
  • By leveraging --fast-list during the same sync these deletions wouldn’t cost anything (i.e. no additional Class C transactions) as b2_delete_file_version (Class A) is free.
  • We don’t have to separately run a rclone cleanup.

If this makes sense I’m happy to create a new GitHub issue.

This seems like a sensible idea. Can you make an issue about it please?

Done! #1547