Skip to content

Instantly share code, notes, and snippets.

@stevewood-tx
Created July 16, 2016 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevewood-tx/d0459ef3cc01f86166d92a87a11f6ee1 to your computer and use it in GitHub Desktop.
Save stevewood-tx/d0459ef3cc01f86166d92a87a11f6ee1 to your computer and use it in GitHub Desktop.
#!/bin/bash
loggedInUser=`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");'`
homeDir=`dscl . read /Users/$loggedInUser NFSHomeDirectory | awk '{ print $2 }'`
homeSize=`du -hs ${homeDir}`
# check for our storage folder, and create if missing
if [[ ! -d "/Library/IT_Data" ]]; then
mkdir "/Library/IT_Data"
fi
defaults write /Library/IT_Data/com.mycompany.homesize.plist HomeFolderSize -string "${homeSize}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment