Last active
November 10, 2015 22:38
-
-
Save sepehr/795a3edea9ed10d91a6f to your computer and use it in GitHub Desktop.
Shell: Find & remove files bigger than X
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
# k: Kilobyte, M: Megabyte, G: Gigabyte | |
# +: Bigger than, -: Lower than | |
find . -maxdepth 1 -type f -size +500k -exec rm -f {} \; | |
# Or better: | |
find . -maxdepth 1 -type f -size +50M -delete | |
# Let's have a look first: | |
find . -maxdepth 1 -type f -size +2G -exec ls -lhS {} \; | awk {print $5 "\t" $9} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment