Skip to content

Instantly share code, notes, and snippets.

@filipsPL
Created December 15, 2017 08:37
Show Gist options
  • Save filipsPL/d4dcc69d16c16d9afc8f16be3edc1480 to your computer and use it in GitHub Desktop.
Save filipsPL/d4dcc69d16c16d9afc8f16be3edc1480 to your computer and use it in GitHub Desktop.
List files bigger than the given size and optionally compress them
#!/bin/bash
### list files bigger than the given size
### and optionally compress them
filesize=100M # files bigger than this will be listed; default is 100M
for f in `find . -type f -size +$filesize`
do
du -sh "$f"
## gzip "$f" # compress each big file
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment