Create a gist now

Instantly share code, notes, and snippets.

Finds all empty directories in /usr/local that are not defined by the Filesystem Hierarchy Standard version 3.0
#!/bin/bash
while read d; do
if ! ls -A "$d" | grep -q ^; then
if [ ! -h "$d" ]; then
echo "$d is an empty, non FHS 3.0 directory"
fi
fi
done < <(find /usr/local -type d | grep -vxE '/usr/local(/etc|/games|/include|/lib(32|64)?|/man(/man[a-z0-9]+)?|/s?bin|/share(/color|/man(/man[a-z0-9]+)?|/misc)?|/src)?')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment