查找Linux下的空目录技巧

代码很土,但也很简单。

if [ -z "$1" ]; then
 echo Usage: $0 \<Target directory\>
 exit 1
fi
echo -e Null directory list:
for i in $(find $1 -type d -print)
do
 TMP=$(ls $i)
 if [ "$TMP" = "\." ]; then
  continue
 elif [ -z "$TMP" ]; then
  echo $i
 fi
done