首页 > 服务器 > Linux服务器 > 正文

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

2024-09-05 23:05:32
字体:
来源:转载
供稿:网友

count脚本

#!/bin/shnumOfArgs=$#if [ $numOfArgs -ne 1 ]; then  echo -e "Usage: /nbash $0 dirForCount"  exit -1fi# argsROOTDIR=$1# core partfind $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

总结

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


注:相关教程知识阅读请移步到服务器教程频道。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表