function disktot, str, list=list, sub=sub, dir=dir
;
;HISTORY:
;	WRitten Dec-91 by M.Morrison
;	2-May-95 (MDM) - Modified to work on Alphas
;
if (n_elements(dir) eq 0) then dir = ''
;
if (keyword_set(sub)) then begin
    if (n_elements(str) eq 0) then cmd = 'ls -lR ' + dir       $
			else cmd = 'ls -lR ' + dir + ' | grep '+str      
end else begin
    if (n_elements(str) eq 0) then str = '*'
    cmd = 'ls -l '+dir+str      
end
spawn, cmd, result
;
tot = long(0)
ist = 0
if (strmid(result(0), 0, 5) eq 'total') then ist = 1
for i=ist, n_elements(result)-1 do begin
    tmp = str2arr( strcompress(result(i)), delim=' ')
    if (keyword_set(list)) then print, tmp(i)
    ;if (n_elements(tmp) eq 8) then tot = tot + long(tmp(3))
    case n_elements(tmp) of
	8: tot = tot + long(tmp(3))
	9: tot = tot + long(tmp(4))
	else:
    endcase
end
;
if ((result(0) eq '') and (n_elements(result) eq 1)) then tot = -1	;no directory?
return, tot
end
