总结选择性du尺寸输出


1

我试图找出超过50M的文件总共消耗了多少空间。我可以使用以下命令生成文件大小列表:

find $PWD/soccer -maxdepth 50 -type f -iname "**" -size +50M |  xargs --delimiter '\n' --max-args=1 du -ha

但我不知道一个简洁的方法来总结它们。可以du在这里帮助我,还是正则表达式+ expr实现这一目标的唯一直接方式?

52M /Videos/soccer/The making of Jari Litmanen part 1.mp4
55M /Videos/soccer/Van Gaal My philosophy makes me one of the best.mp4
68M /Videos/soccer/Zidane Brazil has always inspired me.mp4

到目前为止我提出的最好的是:

!! | xargs ruby -e "puts ARGV.map(&:to_i).inject(&:+)" | numfmt --from-unit=1000 --to=iec-i
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.