Cross platform method to obtain disk usage

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? :slight_smile:

Cheers,
Tim

* Tim Ferrell <Tim.Ferrell@mcgeecorp.com> [0226 16:26]:

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? :slight_smile:

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

路路路

--
'What have you done to the cat? It looks half-dead.'
    -- Schroedinger's wife
Rasputin :: Jack of All Trades - Master of Nuns

"Tim Ferrell" <Tim.Ferrell@mcgeecorp.com> schrieb im Newsbeitrag
news:4203A207.7040102@mcgeecorp.com...

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?

:slight_smile:

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

Kind regards

    robert

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 :frowning:

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

Rob

路路路

On Sat, 5 Feb 2005 01:25:59 +0900, Tim Ferrell <Tim.Ferrell@mcgeecorp.com> wrote:

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.

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

"Tim Ferrell" <Tim.Ferrell@mcgeecorp.com> schrieb im Newsbeitrag
news:4203A207.7040102@mcgeecorp.com...

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?

:slight_smile:

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

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

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

Caio Tiago Oliveira wrote:

Robert Klemme, 4/2/2005 13:50:
> "Tim Ferrell" <Tim.Ferrell@mcgeecorp.com> schrieb im Newsbeitrag
> news:4203A207.7040102@mcgeecorp.com...
>> 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?

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

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

Daniel Berger wrote:

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

"Zach Dennis" <zdennis@mktec.com> schrieb im Newsbeitrag news:4203BFCA.4060806@mktec.com...

Daniel Berger wrote:

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

Definitely! +1 from here

Kind regards

    robert