1

I am trying to find out how much space is consumed in total by files exceeding 50M in size. I am able to generate a list of file sizes with the following command:

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

But I don't know a clean way to sum them all up. Can du help me here, or is regex + expr the only straightforward way to achieve this?

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

The best I've come up with so far is this:

!! | xargs ruby -e "puts ARGV.map(&:to_i).inject(&:+)" | numfmt --from-unit=1000 --to=iec-i

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.