Alex Young wrote:
> Dave Burt wrote:
>> It's a good question.
> I'm not sure about that.  Unless I'm very much mistaken, the problem
> with the script is that Windows has a nasty reaction to being asked the
> free space available on a CD drive when there's no CD in it.  Blech.  It
> makes the drive 'partially available' - some things work, others don't.
>  If I'm right about that, then what's needed is a way to find out which
> drives *can* respond before asking them to do so.

You are right, and the answer to this simple problem is to check the
result of objDrive's IsReady method, but I was talking about the
question behind the question: can we determine disk free space in Ruby?

> On unices, I think this does the trick:
> 
>   $ df -h `mount | grep '^/dev' | cut -f 3 -d ' '`
> 
> Works on Linux and OS X, certainly - I don't have any other BSDs to check.

As I said, I think it would be very handy to have a cross-platform way
of checking disk free space from Ruby. The most useful thing to me seems
a function that takes a path and returns the number of bytes available
there, so that's what I posted. I tested it on a couple of Linuxes with
different "df"s, so I'm not confident my solution will work across posix
platforms.

Cheers,
Dave