feat: add script to calculate top-level folder sizes

This commit is contained in:
Tiberiu Ichim 2026-02-19 21:12:30 +02:00
parent d0c09d04f1
commit 8be6f3a3d0

16
scripts/folder_sizes.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
# Default to current directory if no argument provided
TARGET_DIR=${1:-"."}
if [ ! -d "$TARGET_DIR" ]; then
echo "Error: $TARGET_DIR is not a directory."
exit 1
fi
echo "Calculating sizes for top-level items in: $(realpath "$TARGET_DIR")"
echo "------------------------------------------------------------"
# Run du -sh on all items within the target directory
# We use find to avoid issues with hidden files or too many arguments
find "$TARGET_DIR" -maxdepth 1 -mindepth 1 -exec du -sh {} + | sort -h