Last active
March 8, 2021 10:43
-
-
Save edgartaor/b932ee578f8f5717f49b695b529b5c0c to your computer and use it in GitHub Desktop.
File count and file size of a directory
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
# 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