From ed185957dedd84785df345cc0dca7238f6bab668 Mon Sep 17 00:00:00 2001 From: Chetan Kapoor Date: Thu, 23 Nov 2017 11:30:54 +0100 Subject: [PATCH] Script to find five largest directories added --- scripts/gordo | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/gordo b/scripts/gordo index 9e88cd4..09c093b 100755 --- a/scripts/gordo +++ b/scripts/gordo @@ -1,5 +1,15 @@ #!/bin/bash # Find the five largest subdirectories of the current directory: -echo TODO +OS=$(uname -s) +if [[ $OS == 'Linux' ]]; then + du -hs * | sort -h | tail -5 +elif [[ $OS == 'Darwin' ]]; then + brew list | grep coreutils +if [[ $? -eq 0 ]]; then + du -hs * | gsort -h | tail -5 +else + echo "Please run brew install coreutils and run again" +fi +fi