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.
When dealing with file systems, I usually find myself switching on a
File.exists?
result = (File.exists?('C:\\') ? `dir /-C` : `df .`).split("\n").last
=> "/dev/sda1 110650276 52580520 52449016 51% /"
This assumes only two filesystem styles (Windows and Linux)
···
On Tue, Sep 16, 2008 at 11:17 AM, jim <jhavero@gmail.com> wrote:
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.
--
todb@planb-security.net | ICQ: 335082155 | Note: Due to Google's
privacy policy <http://tinyurl.com/5xbtl> and the United States'
policy on electronic surveillance <http://tinyurl.com/muuyl>,
please do not IM/e-mail me anything you wish to remain secret.
gem install sys-filesystem
Regards,
Dan
···
On Sep 16, 10:17 am, jim <jhav...@gmail.com> wrote:
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.
Hi. I have created gem specifically for checking free disk space:
···
--
Posted via http://www.ruby-forum.com/.
Woot, i didn't know about 'dir /-C'
Shame on my windows-noob head. Ruby is even nice on windows! 
···
--
Posted via http://www.ruby-forum.com/.