shell find 检查文件夹是否包含文件,或者只是空文件

 

empty_dir_check(){
    
        check_dir=$1
        
        if [ -d $check_dir ];then
                file_list=`find ./$check_dir -mindepth 1 -maxdepth 5 -type f`
                if [ $file_list == "" ];then
                         echo "空文件夹"
                         return 0
                else
                           echo "非空文件夹"
                           return 1
fi
else echo "文件夹不存在" return 2
fi
}

 

posted @ 2019-07-30 17:38  lililili——  阅读(767)  评论(0)    收藏  举报