Get free disk space under unix with df command : Utilities « File Directory « Ruby
- Ruby
- File Directory
- Utilities
Get free disk space under unix with df command
def freespace(device=".")
lines = %x(df -k #{device}).split("\n")
n = lines.last.split[1].to_i * 1024
end
puts freespace("/tmp")
Related examples in the same category