Skip to content

Instantly share code, notes, and snippets.

@ruario
Last active December 13, 2015 19:44
Show Gist options
  • Save ruario/21c611b5a7cd2b5ae6b0 to your computer and use it in GitHub Desktop.
Save ruario/21c611b5a7cd2b5ae6b0 to your computer and use it in GitHub Desktop.
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