Is there a good gem for getting recursively calculated directory sizes? In unix, I can use du
, but I want a library that absorbs the difference among OS.
This seems to work:
Dir.glob(File.join(dir, '**', '*'))
.map{ |f| File.size(f) }
.inject(:+)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With