欢迎来到3C源码网
3C源码网

Linux中查看指定文件夹内各个子文件夹内的文件数量

日期: 2020-02-15 19:52:21

时间:2019-03-27 来源/作者:_John_Tian_ 编辑:源码库 文章热度:

count脚本

numOfArgs=$#if [ $numOfArgs -ne 1 ]; then  echo -e "Usage: \nbash $0 dirForCount"  exit -1fiROOTDIR=$1find $ROOTDIR -maxdepth 1 -type d | sort | while read dir; docount=$(find "$dir" -type f | wc -l)echo "$dir: $count"done

执行

$ bash count.sh benchmark
benchmark: 2317
benchmark/0: 20
benchmark/1: 891
benchmark/2: 65
benchmark/3: 13
benchmark/4: 1328

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对ASPKU源码库的支持。


注:相关教程知识阅读请移步到服务器教程频道。

上一篇:Docker上传镜像至私有仓库的方法示例

下一篇:Docker使用编写dockerfile启动node.js应用