Skip to content

Instantly share code, notes, and snippets.

@JohannesBuchner
Created March 18, 2022 23:05
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 JohannesBuchner/3f077d906e84dc613b405215cddef1a8 to your computer and use it in GitHub Desktop.
Save JohannesBuchner/3f077d906e84dc613b405215cddef1a8 to your computer and use it in GitHub Desktop.
Delete files until folder is smaller than 1GB
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