Created
August 19, 2022 21:42
-
-
Save daryltucker/865db085f024b309b287dd6ac334060f to your computer and use it in GitHub Desktop.
Find directories with lots of data within them.
This file contains hidden or 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 | |
function hevrist(){ | |
local MAX=3; | |
local n=0; | |
QUERY=$1; | |
function h_x(){ | |
du -shx $1/* 2>/dev/null | sort -rh | head -n 10; | |
}; | |
while [ -n ${n} ] && [ ${n} -lt ${MAX} ]; do | |
n=$((${n} + 1)); | |
RESULT=`h_x ${QUERY}`; | |
echo "$RESULT"; | |
QUERY="`echo ${RESULT} | head -n 1 | awk '{ print $2 }'`"; | |
echo "========"; | |
done; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment