Ubuntu检测给定目录下的非空文件夹

  1. 编写脚本,e.g. find_folder_with_file.sh
  2. 拷贝脚本到待检测目录下
  3. 给脚本运行权限:
chmod +x find_folder_with_file.sh
  1. 运行脚本
./find_folder_with_file.sh
  1. 脚本内容如下
  1 #!/bin/bash
  2
  3 find ./ -empty -type d -fprint a.txt
  4 find ./ -type d -fprint b.txt
  5 diff a.txt b.txt | grep '^>' | cut -d ' ' -f 2
发布了53 篇原创文章 · 获赞 20 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/lylfv/article/details/89956093