Originally published October 21, 2018 @ 6:19 pm

When you get a filesystem space alert (and they tend to arrive at 3:37 on Saturday morning), deleting various supersized log files is one option I already covered in adequate detail. That is if you get so lucky as to find such a file to delete…

On occasion, the out-of-space situation is like a death by a thousand paper cuts – folders filled with a large number of small files. This little script here fill look for folders matching “log(s)” or “t(e)mp” that are greater than 200MB in size (you can easily adjust these parameters).

To install:

d=/var/adm/bin
f=large_folders.sh
mkdir -p ${d}
wget --no-check-certificate -O ${d}/${f} https://raw.githubusercontent.com/igoros777/kw/master/large_folders.sh
chmod 755 ${d}/${f}
ln -s ${d}/${f} /usr/bin/large-folders

The syntax is simple:

large-folders [directory] [depth]

If you don’t specify the directory name, the script will search all mounted local filesystems.