Last active
August 29, 2017 21:24
-
-
Save opragel/3a1b9030938db2408c9617cdd76b118a to your computer and use it in GitHub Desktop.
ea_google_drivefs_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 | |
currentUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");') | |
currentUserHomeDirectory=$(dscl . -read "/users/$currentUser" NFSHomeDirectory | cut -d " " -f 2) | |
if [ -d "$currentUserHomeDirectory/Library/Application Support/Google/DriveFS" ]; then | |
driveFSSize=$(du -sm "$currentUserHomeDirectory/Library/Application Support/Google/DriveFS" | grep -o '[0-9]*') | |
eaResult="$driveFSSize MB" | |
else | |
eaResult="N/A" | |
fi | |
printf "<result>%s</result>" "$eaResult" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment