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?

https://github.com/djberg96/sys-filesystem/blob/ffi/examples/example_stat.rb

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?

https://github.com/djberg96/sys-filesystem/blob/ffi/examples/example_stat.rb

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs