Getting directory size using ruby

Hi, I want to measure directory size using Ruby. I can use
sys/filesystem gem but I didn’t understand from examples how can it
ensure this?

I musn’t do du -sh directory and using recursive File.size(“…”){ …}
will be very slow for me, so how can I get directory & file
size, can you suggest me something for this?

Thanks.

On Wed, Jan 22, 2014 at 2:24 PM, Ebru A. [email protected]
wrote:

Hi, I want to measure directory size using Ruby. I can use
sys/filesystem gem but I didn’t understand from examples how can it
ensure this?

sys-filesystem/examples/example_stat.rb at main · djberg96/sys-filesystem · GitHub

And I musn’t do du -sh directory so how can I get directory & file
size, can you suggest me something for this?

Traverse with Find or Pathname and sum individual sizes.

Cheers

robert