commit 8d51bda0cc16facc668f02862f32f1cb8ac5d595 Author: neingeist Date: Sun Nov 15 18:36:49 2015 +0100 Initial git commit diff --git a/check_dir_empty b/check_dir_empty new file mode 100755 index 0000000..6113b2a --- /dev/null +++ b/check_dir_empty @@ -0,0 +1,18 @@ +#!/bin/sh + +dir=$1 + +if [ "$dir" = "" ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +count=`find "$dir" -mindepth 1 -maxdepth 1 | wc -l` + +if [ "$count" = "0" ]; then + echo "OK: '$dir' is empty." + exit 0 +else + echo "WARNING: '$dir' is NOT empty ($count entries)." + exit 1 +fi