Skip to content

Instantly share code, notes, and snippets.

@edgartaor
Last active March 8, 2021 10:43
Show Gist options
  • Save edgartaor/b932ee578f8f5717f49b695b529b5c0c to your computer and use it in GitHub Desktop.
Save edgartaor/b932ee578f8f5717f49b695b529b5c0c to your computer and use it in GitHub Desktop.
File count and file size of a directory
# Taken from https://superuser.com/a/1321654
echo "File Count Dir Size Directory"
echo "---------- ---------- -------------------------"
for d in *; do
if [[ -d $d ]]; then
echo `find $d -type f | wc -l` | awk '{printf "%10s ", $0;}'
echo `du -h --max-depth=0 $d` | cut -d\ -f 1 $1 | awk '{printf "%10s ", $0;}'
echo $d
fi
done | sort -n -k1
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment