linux 查看当前目录下每个子目录的文件数量

find . -maxdepth 1 -type d | while read dir; do count=$(find "$dir" -type f | wc -l); echo "$dir : $count"; done

-maxdepth 1    过滤目录的深度

-type d   文件类型为目录

-type f    文件类型为文件

付出是用来忘记的,回报时悄然而至的。不要让梦想,只是梦想!!!
原文地址:https://www.cnblogs.com/SliverLee/p/12486825.html