Created
July 14, 2016 09:13
-
-
Save theqwan-chengwei/c767d852b7d4f4bd26c1e625408dad5c to your computer and use it in GitHub Desktop.
get_dropbox_space_usage.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATA=$(curl -X POST https://api.dropboxapi.com/2/users/get_space_usage --header 'Authorization: Bearer your_token' --header 'Content-Type: application/json' --data 'null') | |
used=$(echo $DATA | sed 's/}//g' | awk '{ print $2}' | sed 's/,//g') | |
allocated=$(echo $DATA | sed 's/}//g' | awk '{ print $7}') | |
echo "total space(bytes):" $allocated | |
echo " used space(bytes):" $used | |
php -r "echo ($allocated - $used) / 1024 / 1024 / 1024 . 'GB';" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment