cross platform method to obtain disk usage

T

Tim Ferrell

I am working on something where one of the requirements is to manage
disk usage (kind of a rotating backup thing) and I was wondering if
anyone could point me in the right direction for determining disk usage
from Ruby.

I have been tinkering with using syscall (I am on Linux) but ultimately
I'd like to find a way to do this on Windows as well... Any thoughts? I
am not against using C if necessary, but perhaps that can be avoided? :)

Cheers,
Tim
 
D

Dick Davies

* Tim Ferrell said:
I am working on something where one of the requirements is to manage
disk usage (kind of a rotating backup thing) and I was wondering if
anyone could point me in the right direction for determining disk usage
from Ruby.

I have been tinkering with using syscall (I am on Linux) but ultimately
I'd like to find a way to do this on Windows as well... Any thoughts? I
am not against using C if necessary, but perhaps that can be avoided? :)


How cross-platform? I'd do it with snmp myself, but you might need to tweak
the clients....
 
R

Robert Klemme

Tim Ferrell said:
I am working on something where one of the requirements is to manage
disk usage (kind of a rotating backup thing) and I was wondering if
anyone could point me in the right direction for determining disk usage
from Ruby.

I have been tinkering with using syscall (I am on Linux) but ultimately
I'd like to find a way to do this on Windows as well... Any thoughts? I
am not against using C if necessary, but perhaps that can be avoided?
:)

Hm, probably this is helpful:
http://raa.ruby-lang.org/project/filesystem/

Kind regards

robert
 
R

Robert McGovern

I am working on something where one of the requirements is to manage
disk usage (kind of a rotating backup thing) and I was wondering if
anyone could point me in the right direction for determining disk usage
from Ruby.

Don't know, I do know that there has been an open bug / request for
enhancement in Java for this for the last 7 years. The current target
is JDK1.6, maybe 2 years away :(

So if there was a way in Ruby, it would be another good reason for
Java people to join the Ruby party ;)

Rob
 
D

Daniel Berger

Caio said:
Robert Klemme, 4/2/2005 13:50:

The page says: "Tested on Linux and Solaris.".
I don't think it works on windows.

"'statvfs' and 'getmntent'"...

I've tested it on FreeBSD and HP-UX as well.

No, it doesn't work on Windows. I've been mulling over a
win32-filesystem package for win32utils, but I don't know that it's
realistic to keep a unified API between *nix and Win32. But, I'll mull
it over.

Regards,

Dan
 
Z

Zach Dennis

Daniel said:
I've tested it on FreeBSD and HP-UX as well.

No, it doesn't work on Windows. I've been mulling over a
win32-filesystem package for win32utils, but I don't know that it's
realistic to keep a unified API between *nix and Win32. But, I'll mull
it over.

I'd think their should be a unified API in the ruby library for getting
this information, rather then have two separate methods in potentially
two separate packages for accessing this information long term depending
on whether you're on a *nix or windows machine. Let's make this easier
on the developer, thus making ruby more attractive for developers from
other languages.

Short term if a method is added to the win32utils then I would think
that is good to have, but ultimately consistency and transparency to the
user (developer) would be the ultimate goal. IMO

Zach
 
R

Robert Klemme

Zach Dennis said:
I'd think their should be a unified API in the ruby library for getting
this information, rather then have two separate methods in potentially two
separate packages for accessing this information long term depending on
whether you're on a *nix or windows machine. Let's make this easier on the
developer, thus making ruby more attractive for developers from other
languages.

Short term if a method is added to the win32utils then I would think that
is good to have, but ultimately consistency and transparency to the user
(developer) would be the ultimate goal. IMO

Definitely! +1 from here

Kind regards

robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top