Skip to content

Instantly share code, notes, and snippets.

@opragel
Last active August 29, 2017 21:24
Show Gist options
  • Save opragel/3a1b9030938db2408c9617cdd76b118a to your computer and use it in GitHub Desktop.
Save opragel/3a1b9030938db2408c9617cdd76b118a to your computer and use it in GitHub Desktop.
ea_google_drivefs_usage.sh
#!/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