Unsolved Need a script to cleanup a Backblaze B2 bucket
-
RClone might be able to do this: https://rclone.org/b2/
-
@Curtis How? Rclone has no idea what my needed schedule is. Rclone is just a tool to send commands to B2 in this scenario.
Something needs to know/determine what files exist and then mark them hidden appropriately.
-
If you can keep the backup locally, then rclone or b2 api can do this, by performing the rules locally then syncing it to the cloud.
If you cant keep them locally due to size, why not create cron rclone dummy rule to sync dummy file to that bucket, this will force it to delete b2 storage cause that dummy file is not existing, you will need to use rclone sync function and not copy.
-
Why are you all hung up on using a backup tool like
rclone
? I have working solid backups. I don't need another backup system to be setup and maintained.Using the B2 API is not terribly difficult I see no reason to do anything else. A script that pulls down the information, and then runs a simple date logic loop and tells the appropriate things to "delete" does not seem that complicated.
Feel free to convince me I am wrong, but so far I am not feeling it.
-
@Emad-R said in Need a script to cleanup a Backblaze B2 bucket:
If you can keep the backup locally,
The scenario was clearly stated. The local and remote retention periods are different.
-
I have had this limitation with B2 for a while and will be interesting to see what the outcome is on this scenario.
-
I haven't played a ton with the b2 CLI, but are you able to hide the files you need to keep and then run your cleanup and then unhide those files with wildcards?
b2 hide-file <bucketName> <fileName>
Maybe something like
b2 hide-file Jared synology-5-*
Also this documentation may be useful to building an answer. I assume you've already seen it.
-
Or maybe as an alternative, hide the files that are "old" and then remove those so you're only seeing the current backups.
-
@DustinB3403 said in Need a script to cleanup a Backblaze B2 bucket:
Also this documentation may be useful to building an answer. I assume you've already seen it.
Yes, tha tis what I was looking at using, yes.
-
Here's some additional information, specifically using rclone into b2.