Get the available space of Dropbox using Linux command line

5

I'm using CentOS. Is there a way to get the unused space in my Dropbox account using the command line?

Steve

Posted 2013-12-10T14:35:01.840

Reputation: 463

You would have thought the Official Dropbox Command Line Interface (CLI) would have an option to query the free space but unfortunately it doesn't.

– Rik – 2013-12-10T14:47:07.717

Answers

3

You can use the Dropbox API to get your current usage. Download the Python SDK (and make sure you have Python installed). In the examples folder of the SDK there is a cli_client.py. Edit that file with your developer keys and then use the "account_info" command to see your usage.

heavyd

Posted 2013-12-10T14:35:01.840

Reputation: 54 755

2

There does not seem to be an official solution for this. You can however use du to find out the size of your Dropbox folder and calculate how much space you have left from that.

Some example scripts doing a similar thing can be found on this page. Just calculate the difference instead of the percentage.

I would use du -cLl $HOME/Dropbox instead of du -c $HOME/Dropbox. This way symbolic links and hardlinks are counted correctly.

Also note that this solution only works if you sync your complete Dropbox on the PC in question. If you use selective sync, you must approximate the space used by folders not present on this system. This makes the system unreliable. As a workaround you could have a cronjob that writes the sizes of other folders into a file in your dropbox and use this file for your calculations.

Tim

Posted 2013-12-10T14:35:01.840

Reputation: 1 811