Skip to content

Instantly share code, notes, and snippets.

@daryltucker
Created August 19, 2022 21:42
Show Gist options
  • Save daryltucker/865db085f024b309b287dd6ac334060f to your computer and use it in GitHub Desktop.
Save daryltucker/865db085f024b309b287dd6ac334060f to your computer and use it in GitHub Desktop.
Find directories with lots of data within them.
#!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