Created
July 16, 2016 20:00
-
-
Save stevewood-tx/d0459ef3cc01f86166d92a87a11f6ee1 to your computer and use it in GitHub Desktop.
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 | |
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