alias -l sub.drives {
; cycle drives
if ($1 == begin) {
var %asc = 99
while (%asc <= 122) {
if ($disk($chr(%asc))) {
var %d = $upper($chr(%asc))
; store sums of fixed/removable drives
if ($istok(fixed removable,$disk(%d).type,32)) {
set -u %sub.drive.list $addtok(%sub.drive.list,%d 1 $disk(%d).size $disk(%d).free,124)
inc -u %sub.drive.total $disk(%d).size
inc -u %sub.drive.free $disk(%d).free
}
; other drives: store only type
else { set -u %sub.drive.list $addtok(%sub.drive.list,%d $disk(%d).type 0 0,124) }
}
inc %asc
}
}
; return drive info
elseif (($1 isnum) && ($gettok(%sub.drive.list,$1,124))) {
var %d = $gettok($v1,1,32),%ty = $gettok($v1,2,32), %t = $gettok($v1,3,32), %f = $gettok($v1,4,32)
return Drive %d $chr(149) $iif((%ty != 1),$upper($v1) $qt($disk(%d).label),$qt($disk(%d).label) $chr(149) $&
$bytes(%t,g) GB $+([,free $bytes(%f,g) GB = $round($calc(%f / %t *100),1),$chr(37),])) : run $disk($1).path
}
; return totals
elseif ($1 == end) {
return --TOTAL-- $bytes(%sub.drive.total,g) GB $+([,free $bytes(%sub.drive.free,g) GB = $&
$round($calc(%sub.drive.free / %sub.drive.total *100),1),$chr(37),]) : noop
}
}
menu status {
Drive Info
.$submenu($sub.drives($1))
}