Created
March 18, 2022 23:05
-
-
Save JohannesBuchner/3f077d906e84dc613b405215cddef1a8 to your computer and use it in GitHub Desktop.
Delete files until folder is smaller than 1GB
This file contains 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
find $FOLDER -maxdepth 1 -type f -printf '%s\t%p\n' | | |
{ S=0; while read s l; do | |
((S+=s)); [[ $S -gt 1000000000 ]] && rm -v "$l"; | |
done; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment