Last active
January 14, 2020 13:44
-
-
Save Erikdegroot89/d9a7e1efec12ac65e567e4b1fc13fc1e to your computer and use it in GitHub Desktop.
Shell script that echo's all files larger than 2 MB.
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
#/bin/sh | |
# Iterate given directory echoes every file that's larger than 2MB | |
# See also https://explainshell.com/explain?cmd=find+.%2F+-maxdepth+2+-size+%2B2M | |
find $1 -maxdepth 2 -size +2M | while read file; | |
do | |
FILESIZE=$(stat -c%s "$file") | |
echo "$file is too large: ($FILESIZE)" | |
# add any scripts you'd want to call here | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment