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

free space via MEGAcmd needs to be calculated #1014

Open
gidici opened this issue Dec 20, 2024 · 2 comments
Open

free space via MEGAcmd needs to be calculated #1014

gidici opened this issue Dec 20, 2024 · 2 comments
Labels

Comments

@gidici
Copy link

gidici commented Dec 20, 2024

MEGAcmd version

1.7.0

Operating System/Platform

Linux

Platform version. In the case of Linux, please enter the Linux distribution you are using.

Debian 12

Steps

In a bash shell I try to calculate the free available space in my MEGA cloud; I have read the MEGA commands, but haven't find a command to get the free space as one single number to be used in bash scripts.

Expected behavior

I would like to get the free available space with just one command; currently I need to write
used=$( mega-df | grep "USED STORAGE:" | awk -F'[^0-9]' '$0=$2')
total=$(mega-df | grep "USED STORAGE:" | awk -F'[^0-9]
' '$0=$5')
free=$((total-used))
However, mega-df and mega-du doesn't return the same value; e.g.
mega-df returns
USED STORAGE: 21051345911 39.21% of 53687091200
(Cloud drive=20309471541 + Rubbish bin=741874370 = 21051345911)
while mega-du returns 20304533872
Thank you for your help

Actual behavior

  1. I have to calculate the free space by myself (see above)
  2. mega-df and mega-du don't give the same result; I don't know which one should I use
@gidici gidici added the bug label Dec 20, 2024
@polmr
Copy link
Collaborator

polmr commented Dec 20, 2024

  1. Feature request noted. Thanks!
  2. Ensure you pass --versions to mega-du, so that you get the size including old versions of files
mega-du --versions

@gidici
Copy link
Author

gidici commented Dec 20, 2024

Thanks for the answer, but.... what is the right value that I should take as "used space" when calculating the remaining free space? Please look at this:
$ mega-du --versions
FILENAME SIZE S.WITH VERS
/: 20304533872 20309471541


Total storage used: 20304533872 20309471541
$
$ mega-df
Cloud drive: 20309471541 in 2243 file(s) and 233 folder(s)
Inbox: 0 in 0 file(s) and 0 folder(s)
Rubbish bin: 741874370 in 60 file(s) and 32 folder(s)
Incoming shares:
Berlino con papi: 1675361732 in 233 file(s) and 4 folder(s)


USED STORAGE: 21051345911 39.21% of 53687091200


Total size taken up by file versions: 4937669

In this case the remaining free space that I can use is (53687091200 - 20309471541) or (53687091200 - 21051345911)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants