获取与查找和放文件夹总大小;杜 [英] Get total size of folders with find & du
本文介绍了获取与查找和放文件夹总大小;杜的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让一个名为比克以查找和杜目录的大小。
I'm trying to get the size of the directories named "bak" with find and du.
我这样做:找到-name李明博型ð-exec杜-CH'{}'\\;
但它返回的大小名为每个文件夹比克,而不是总的。
But it returns the size for each folder named "bak" not the total.
反正让他们?感谢:)
推荐答案
使用 xargs的(1)
代替 -exec
:
find . -name bak -type d | xargs du -ch
-exec
执行找到的每个文件的命令(查看 找到(1)
文档)。管路的xargs
可让您聚合这些文件名和只运行杜
一次。你也可以这样做:
-exec
executes the command for each file found (check the find(1)
documentation). Piping to xargs
lets you aggregate those filenames and only run du
once. You could also do:
find -name bak -type d -exec du -ch '{}' \; +
如果你的找到
版本支持它。
这篇关于获取与查找和放文件夹总大小;杜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文