首页 > 系统 > Linux > 正文

查找Linux下的空目录

2020-06-07 13:34:13
字体:
来源:转载
供稿:网友

查找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

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表