diskfree.awk
Generated on Tue Dec 05 17:39:06 Eastern Standard Time 2006 from diskfree.awk
# Program : DISKFREE.AWK
# Purpose : Format information from DF.EXE -b X:
# Author : Bob Jonkman <bjonkman@sobac.com>
# Copyright 2008 Bob Jonkman and/or SOBAC Microcomputer Services
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Date : 3 February 2006
# Note : DF.EXE was available from http://www.paulsadowski.com/
# DF output format: $1 = Drive letter
# $2 = Total
# $3 = Used
# $4 = Free
# $5 = % Used
# $6 = volume
# $7 = File system
# $8 = Path
function k2gi(k) { return (k*1000/Gibi) # DF outputs size in 1000 bytes
}
BEGIN { Gibi = 1024*1024*1024 ;
OFS = ","
print("% Used, GiBytes Used, GiBytes Free, GiBytes Total, Path") ;
}
{ printf("%2i %,%8.2f,%8.2f,%8.2f,%s\n", $3/$2*100, k2gi($3), k2gi($4), k2gi($2) ,$8) | "SORT /R"
used += $3
free += $4
total += $2
servers++
}
END { print("=====")
printf("%2i %,%8.2f,%8.2f,%8.2f,%s\n", used/total*100, k2gi(used), k2gi(free), k2gi(total),"Aggregate" )
print("Servers," servers)
print("Date," strftime("%Y-%m-%d") ",Time," strftime("%H:%M:%S"))
}
# EOF: DISKFREE.AWK
1 files processed.