Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i get the total size of a specific folder in a bucket? #885

Closed
dmirallestl opened this issue Jun 15, 2023 · 2 comments
Closed

How can i get the total size of a specific folder in a bucket? #885

dmirallestl opened this issue Jun 15, 2023 · 2 comments

Comments

@dmirallestl
Copy link

We have a bucket were we are storing data related to our clients, the idea is to get the total size used by each client. I don't see any way to get that information from b2-cli, is there any other way such as API call to get this information easily?

@dmirallestl dmirallestl changed the title How can i get the total size of an specific folder in a bucket? How can i get the total size of a specific folder in a bucket? Jun 15, 2023
@mjurbanski-reef
Copy link
Collaborator

The way to do this is something like:

b2v3 ls -r bucketName path --versions --long| awk '{total+=$5;} END{print total;}'

or

b2v3 ls -r bucketName path --versions --json|  jq -r '.[].size' | awk '{total+=$1} END {print total}'

Remove --versions if you want to see only how much space is used by most recent versions.
See https://www.backblaze.com/docs/cloud-storage-lifecycle-rules how to delete old versions automatically.

@S0yKaf
Copy link

S0yKaf commented Jun 13, 2024

@mjurbanski-reef
I know I'm bumping an old thread for this. but I love you. You have no idea how much you've just helped me with this answer. Seriously. You've made my week.

Thank you.

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

No branches or pull requests

3 participants