ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Need a script to cleanup a Backblaze B2 bucket

    Scheduled Pinned Locked Moved Unsolved IT Discussion
    backblazebackblaze b2cleanupscript
    11 Posts 5 Posters 1.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      Curtis
      last edited by

      RClone might be able to do this: https://rclone.org/b2/

      JaredBuschJ 1 Reply Last reply Reply Quote 0
      • JaredBuschJ
        JaredBusch @Curtis
        last edited by

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

        Emad RE 1 Reply Last reply Reply Quote 0
        • Emad RE
          Emad R @JaredBusch
          last edited by Emad R

          @JaredBusch

          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.

          JaredBuschJ 1 Reply Last reply Reply Quote 0
          • JaredBuschJ
            JaredBusch
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • JaredBuschJ
              JaredBusch @Emad R
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • dbeatoD
                dbeato
                last edited by

                I have had this limitation with B2 for a while and will be interesting to see what the outcome is on this scenario.

                1 Reply Last reply Reply Quote 0
                • DustinB3403D
                  DustinB3403
                  last edited by DustinB3403

                  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.

                  JaredBuschJ 1 Reply Last reply Reply Quote 0
                  • DustinB3403D
                    DustinB3403
                    last edited by

                    Or maybe as an alternative, hide the files that are "old" and then remove those so you're only seeing the current backups.

                    1 Reply Last reply Reply Quote 0
                    • JaredBuschJ
                      JaredBusch @DustinB3403
                      last edited by

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

                      1 Reply Last reply Reply Quote 0
                      • DustinB3403D
                        DustinB3403
                        last edited by

                        Here's some additional information, specifically using rclone into b2.

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • First post
                          Last post