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.
相关问题
- How to access the camera from my Windows Phone 8 a
- How to specify memcache server to Rack::Session::M
- Why am I getting a “C compiler cannot create execu
- reference to a method?
- ruby 1.9 wrong file encoding on windows
相关文章
- Ruby using wrong version of openssl
- Difference between Thread#run and Thread#wakeup?
- how to call a active record named scope with a str
- “No explicit conversion of Symbol into String” for
- Segmentation fault with ruby 2.0.0p247 leading to
- How to detect if an element exists in Watir
- uninitialized constant Mysql2::Client::SECURE_CONN
- ruby - simplify string multiply concatenation
Here's my solution using http://ruby-doc.org/core-2.2.0/File.html#method-c-size:
Check out the
File::Stat
class (note that it does not calculate size of directory contents, it needs to be done manually).http://ruby-doc.org/core-1.9.3/File/Stat.html#method-i-size
Support Tools:
Microsoft ... system install CD
Sysinternals Suite Utilities:
Microsoft ...
Sysinternals Suite
This seems to work:
Could something like this work for you?
Looks like sys-filesystem handles this, but you'll need to do some math to convert the available blocks into bytes (by multiplying by block-size).