Last active
October 17, 2025 01:14
-
-
Save oxagast/f2941fe4fa19f2a25028ac2dda6fa4b3 to your computer and use it in GitHub Desktop.
File Growth Watcher
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
#!/usr/bin/bash | |
# oxagast / [email protected] | |
if [[ $# -eq 1 ]] || [[ $# -eq 2 ]]; then | |
if [[ $# -eq 1 ]]; then | |
ESIZE=1000000000000000000; | |
fi | |
if [[ $# -eq 2 ]]; then | |
ESIZE=$2; | |
fi | |
while test -s $1 && [[ $ESIZE -ge $(stat --printf "%s" $1) ]]; do | |
stat --printf "%s" $1 | numfmt --to-unit M --format "%.2f" | xargs printf "\rSize: %8.2fmb | $1" | |
sleep 0.3 ; | |
done | |
else | |
echo "useage: $0 [filename] [target size in bytes]"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment