I would like to get the size of a specific directory that exists on some of our imaged computers. I'm still very much a noob when it comes to bash, so I'm looking for some help from my fellow Casper gurus.
I know I can use the "du" command to return a human readable size. However, what if the directory doesn't exist on that specific asset in inventory. How do I check for the directory first, then return the size if it exists?
I think this should return the size of the directory:
du -hs "/Volumes/Macintosh HD/Users/Shared/Active Jobs" | awk '{print $1}'
returns: 69G
But I want it to return 0 if the directory doesn't exist. Thoughts?
--
James Fuller | Starbucks Coffee Company | Technology Application Services | application developer II