$ ! File: Sys$SysDevice:[DiskQuota]BuildBad.COM $ ! $ ! Author: P. Lind $ ! $ ! Latest Change 15-JUN-1984 $ ! $ ! $ ! This Command file reads a list of home directories and quotas. It $ ! performes a Directory/Size=allocation/Total on that directory and all $ ! subdirectories. If the space usage exceeds the quota the directory, $ ! excess, and quota are written into a "BadList". $ ! $ ! $ QuotaDir := "Sys$SysDevice:[DiskQuota]" $ on control_y then goto close $ on error then continue $ OutFile := 'QuotaDir'Dir.Tmp $ open/read CheckList 'QuotaDir'CheckList.txt $ create 'QuotaDir'NewBad.txt $ open/APPEND BadList 'QuotaDir'NewBad.txt $ write BadList "!" $ Write BadList "! Original BadList for ''F$Time()'" $ Write BadList "!" $ Write BadList "!" $ ReadNext: $ on Error then goto ReadNext $ IF F$SEARCH(OutFile) .NES. "" THEN deletexx 'OutFile';* $ read/end=close checklist User $ user := 'user' $ if user .eqs. "" then goto readnext $! $! $ BrackPos = F$Locate("[",User) $ DotPos = F$Locate(".",User) $ if DotPos .eq. 'F$Length(User)' THEN DotPos = DotPos - 1 $ DotPos = DotPos - BrackPos $ ThisUser := 'F$EXTRACT(BrackPos, DotPos, User)' $ ThisUser := 'F$PARSE(User,,,"DEVICE")''ThisUser' $! $! $ read/end=close checklist Limit $! $ Write Sys$output "Now Checking ''ThisUser'...]" $ directoryxx/output='OutFile'/size=allocation/Grand_Total 'ThisUser'...] $ open/read dirfile 'OutFile' $ loop: $ on error then continue $ read/error=closedir/end=closedir dirfile line $ Line = F$EDIT(Line, "COMPRESS, TRIM") $ IF Line .eqs. "" THEN goto loop $ closedir: $ close dirfile $ Number = F$ELEMENT(7, " ", Line) $ write sys$output "''Line' Allocated blocks = ''Number'" $ deletexx 'OutFile';* $ Excess = 'Number' - 'Limit' $ if Excess .le. 0 then goto readnext $ write/error=close Badlist User $ Write/Error=close BadList Limit $ write/error=close Badlist Excess $ goto readnext $ close: $ on error then continue $ close CheckList $ close Badlist $ IF F$SEARCH(OutFile) .NES. "" THEN deletexx 'OutFile';* $ renamexx 'QuotaDir'NewBad.txt 'QuotaDir'BadList.txt $ set prot=w:rewd 'QuotaDir'BadList.txt $ purgexx 'QuotaDir'BadList.txt $ renamexx 'QuotaDir'BadList.txt.* 'QuotaDir'BadList.txt;1 $ exit