Skip to content

Instantly share code, notes, and snippets.

@kmturley
Last active July 31, 2020 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmturley/5bcae3dc49c3bbb942411837e1b0fa71 to your computer and use it in GitHub Desktop.
Save kmturley/5bcae3dc49c3bbb942411837e1b0fa71 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Usage:
# bash stats.sh ./directory
# bash stats.sh ./directory > stats.log
(
# Find number of children
find $1 -maxdepth 1 -type d -print0 | while read -d '' -r dir; do num=$(find $dir -ls | wc -l); printf "%5d %s\n" "$num" "$dir"; done
# Find size
du -hd1 $1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment