Get free disk space under windows with dir command
def freespace(device=".") lines = %x(cmd /c dir #{device}).split("\n") n = lines.last.split[2].delete(",").to_i end puts freespace "C:"