我可以列出所有目录
find ./ -type d
我尝试使用以下命令列出每个目录的内容并统计每个目录中的文件数
find ./ -type d | xargs ls -l | wc -l
但是这总结了返回的总行数
find ./ -type d | xargs ls -l
有没有办法统计每个目录中的文件数?
最佳答案
这会打印当前目录级别的每个目录的文件计数:
du -a | cut -d/ -f2 | sort | uniq -c | sort -nr
https://stackoverflow.com/questions/15216370/