[英]how to see all directory sizes named invoices in a bash script
I have a list of directories and was wondering if there was a bash script to do maybe a for loop to go through and enter du -h
at the last directory ( /something/something/invoices
).我有一个目录列表,想知道是否有一个 bash 脚本可以执行到 go 的 for 循环,并在最后一个目录 ( /something/something/invoices
) 中输入du -h
。 Or is there a better command to do than: find / -type d -name "/something/something/invoices" -ls
that would include the invoices directory sizes.或者有比以下更好的命令: find / -type d -name "/something/something/invoices" -ls
将包括发票目录大小。
Thank you and hope to hear from someone.谢谢你,希望能听到某人的消息。
If invoices
can appear on any depth in the subtree, use find
's -exec
option:如果invoices
可以出现在子树的任何深度,请使用find
的-exec
选项:
find / -type d -name invoices -exec du -h {} \;
3,5M /here/there/invoices
1,6M /somewhere/else/invoices
560K /nested/really/really/really/deep/invoices
:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.