mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 05:29:41 +00:00
feat: add script to calculate top-level folder sizes
This commit is contained in:
parent
d0c09d04f1
commit
8be6f3a3d0
1 changed files with 16 additions and 0 deletions
16
scripts/folder_sizes.sh
Executable file
16
scripts/folder_sizes.sh
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue