用'查找'选择的文件组的总大小 [英] total size of group of files selected with 'find'
问题描述
pre $ find $ / rapid_shrinking_drive / -type f -mtime -1 -ls |减去
我发现很多东西。数以千计的六七类文件。
$ p $ find $ / rapid_shrinking_drive / -name* offender1 *-mtime -1 - ls | wc -l
但是我真正喜欢的是能够获得磁盘上的总大小
$ b
find / rapidly_shrinking_drive / -name* offender1 *-mtime -1 |如果有人有一个,我打开Perl的一行,但我我不打算使用任何涉及多行脚本或File :: Find的解决方案。 命令< a href =http://linux.die.net/man/1/du =noreferrer> du
告诉你磁盘使用情况。
$ b find quickly_shrinking_drive / -nameoffender1-mtime -1 -print0 | du --files0-from = - -hc | tail -n1
<先前我写过 du -hs
,但是在我的机器上,似乎忽略 find
的输入,而是总结了cwd的大小。)
For instance, I have a large filesystem that is filling up faster than I expected. So I look for what's being added:
find /rapidly_shrinking_drive/ -type f -mtime -1 -ls | less
And I find, well, lots of stuff. Thousands of files of six-seven types. I can single out a type and count them:
find /rapidly_shrinking_drive/ -name "*offender1*" -mtime -1 -ls | wc -l
but what I'd really like is to be able to get the total size on disk of these files:
find /rapidly_shrinking_drive/ -name "*offender1*" -mtime -1 | howmuchspace
I'm open to a Perl one-liner for this, if someone's got one, but I'm not going to use any solution that involves a multi-line script, or File::Find.
解决方案 The command du
tells you about disk usage. Example usage for your specific case:
find rapidly_shrinking_drive/ -name "offender1" -mtime -1 -print0 | du --files0-from=- -hc | tail -n1
(Previously I wrote du -hs
, but on my machine that appears to disregard find
's input and instead summarises the size of the cwd.)
这篇关于用'查找'选择的文件组的总大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!