check available disk space

ruby

    Sponsored Links

    Next

  • 1. gem bug?
    OK, this is very strange. I'm guessing it's (somehow) gem-related. Yesterday I installed Rails on a remote server -- but then changed my mind and didn't use it there, and installed it elsewhere. So anyway: It brought over a few dependencies like ActiveRecord. I have a plain old CGI (yeah, call me a Luddite) which suddenly quit working yesterday. It *doesn't* use AR or anything, but it does use DBM and YAML. It was crashing while trying to store a yaml'd string in the dbm. (I've done some playing with YAML, and I have #load aliased to #old_load.) Oddly, it seemed to be using yaml.rb instead of the extension (syck?). On the theory that nothing happens without a reason (yeah, call me optimistic) -- I looked for files named "*yaml*" and found a yaml_wrapper.rb under /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.6.0/lib/active_record/wrappers/ Uninstalling AR, or even just moving that one file, fixes my crash. And yet David assures me this is "old code, not loaded anywhere." Sure enough, I don't find any requires of it with grep. But the fact remains: If that file is there, my app crashes. If it isn't, it doesn't. Chad, Jim, if you want more info, just ask... Hal
  • 2. Simple extension question
    Hi .. What is the easy way of clearing an array in an extension? ie Given VALUE t_init(VALUE self) { VALUE foo; foo = rb_ary_new(); rb_iv_set(self, "@foo", foo); } How do I do the equivalent of "foo.clear" ? Thanks, -- -mark. (probertm at acm dot org)

check available disk space

Postby jim » Thu, 18 Sep 2008 01:23:18 GMT

Does anyone know how I can write a Ruby script that can check for
available disk space on the current working directory? I'd like to be
able to run the script from Windows and Linux.

Re: check available disk space

Postby Tod Beardsley » Thu, 18 Sep 2008 01:51:09 GMT

When dealing with file systems, I usually find myself switching on a
File.exists?

=> "/dev/sda1            110650276  52580520  52449016  51% /"

This assumes only two filesystem styles (Windows and Linux)






-- 
 XXXX@XXXXX.COM  | ICQ: 335082155 | Note: Due to Google's
privacy policy < http://www.**--****.com/ ; and the United States'
policy on electronic surveillance < http://www.**--****.com/ ;,
please do not IM/e-mail me anything you wish to remain secret.


Re: check available disk space

Postby Daniel Berger » Thu, 18 Sep 2008 04:42:58 GMT




gem install sys-filesystem

Regards,

Dan


Re: check available disk space

Postby Marc Heiler » Thu, 18 Sep 2008 07:30:16 GMT

Woot, i didn't know about 'dir /-C'

Shame on my windows-noob head. Ruby is even nice on windows! :-)
-- 
Posted via  http://www.**--****.com/ 


Similar Threads:

1.Free disk space with VMI in megabyte

2.Disk Free Space

Hi,

Is a way to know free disk space left other that using Win32 API or a
system call on linux ?

Mickael.


3.Disk space allocation

4.[ADV] Compleat Rubyist in Chicago -- space still available!

5.Spaces in RUBLIB become spaces in $: paths ?

On XP, spaces between paths in the the RUBYLIB environment variable result
in spaces in the paths strings in $:

ENV['RUBYLIB] #=> "C:/foo; C:/bar"
$: #=> ["C:/foo", " C:/bar"]

Is this intended? It seems error prone.


6. [ANN] Hpricot 0.2 -- scanner: check, parser: check.

7. cross platform method to obtain disk usage

8. Store object in on disk / mini database



Return to ruby

 

Who is online

Users browsing this forum: No registered users and 64 guest