Error[8]: Undefined offset: 4, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

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

count脚本

#!/bin/sh
numOfArgs=$#
if [ $numOfArgs -ne 1 ]; then
  echo -e "Usage: \nbash 执行 dirForCount"
  exit -1
fi
# args
ROOTDIR=
# core part
find $ROOTDIR -maxdepth 1 -type d | sort | while read dir; do
count=$(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

[+++]

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对脚本之家的支持。如果你想了解更多相关内容请查看下面相关链接

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
dirForCount"exit -1 fi # " /> dirForCount"exit -1 fi # "> Linux中查看指定文件夹内各个子文件夹内的文件数量_软件运维_内存溢出

阅读 24

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

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

count脚本



#!/bin/sh
numOfArgs=$#
if [ $numOfArgs -ne 1 ]; then
  echo -e "Usage: \nbash 
执行

dirForCount" exit -1 fi # args ROOTDIR= # core part find $ROOTDIR -maxdepth 1 -type d | sort | while read dir; do count=$(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

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对脚本之家的支持。如果你想了解更多相关内容请查看下面相关链接

欢迎分享,转载请注明来源:

内存溢出

原文地址:

https://outofmemory.cn/yw/902943.html
linux中查看指定文件夹内各个子文件夹内的文件数量
(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
code code 管理员组
bash命令使用详解
上一篇
2022-05-15
Linux centos下设置定时备份任务的方法步骤
2022-05-15

发表评论
请登录后评论... 登录
提交

    评论列表(0条)
保存
{label} {label} dirForCount"exit -1fi#', author : 'code', cat_name : '软件运维', time_y_m : '2022年05月', time_d : '15', site_motto : '内存溢出' }; {script} {script}