From: Dave Burt Date: 2006-05-20T01:05:38+09:00 Subject: Re: Disk Free Space (Re: Who Wants to Be a Scripting Guy?) Edwin van Leeuwen wrote: > I found a ruby version of df a long time ago. It did a syscall(99), so > if this syscall is a standard POSIX one then the script should work on > all posix compliant os-es > The relevant part: > size = 64 > unpack_fmt = 'iiiiiiiiiiiiiiii' > foo = ' ' * size > syscall(99, hd[1], foo) > type, @bsize, @blocks, @bfree, @bavail, @files, @ffree, > tmp,tmp,@namelen = foo.unpack(unpack_fmt) > usage=100*(@blocks-@bfree)/@blocks In the above code, what's hd? And would this be more or less portable than my suggestion? `df -k #{dir}`[/\n.{20} (\d+)/, 1].to_i * 1024 (Does this work on your *nix?) Cheers, Dave