(view source code of diskuse.rex as plain text)
/* DiskUse.cmd, Version 4.00 for OS/2 and Regina Rexx *//* Display diskspace used by subdirectories *//* Written by Rob van der Woude *//* http://www.robvanderwoude.com *//* Initialize RexxUtil */Call RxFuncAdd "sysloadfuncs", "RexxUtil", "sysloadfuncs"
Call sysloadfuncs/* Initialize RexxLib */If RxFuncQuery( "RexxLibRegister" ) <> 0 Then Do
If RxFuncAdd( "RexxLibRegister", "RexxLib", "RexxLibRegister" ) = 0 Then Call RexxLibRegister
End/* Command line parsing */Parse Upper Arg startdir
If Pos( "?", startdir ) > 0 Then Call Syntax
SelectWhen startdir = "" Then fdir = directory( )
When startdir = "." Then fdir = directory( )
When startdir = ".." Then fdir = directory( ".\..\." )
Otherwise Do
Call SysFileTree startdir, "exist.", "DO"
If exist.0 <> 1 Then Do
Call Syntax "Specified startdir not found: "||startdir
End fdir = exist.1 EndEndfdir = Strip( fdir, "T", "\" )
fdlen = Length( fdir ) + 1
/* Display total file size for start directory */Call SysFileTree fdir||"\*", "files.", "F"
totalsize = 0
If files.0 > 0 Then Do j = 1 to files.0
Parse Value files.j With . . fsize . files.j
files.j = Strip( files.j )
totalsize = totalsize + fsize
EndSay ".\="||totalsize
/* Display total file size for all subdirectories */Call SysFileTree fdir||"\*", "fdirs.", "DO"
If fdirs.0 > 0 Then Do
If RxFuncQuery( "ArraySort" ) = 0 Then Call ArraySort "fdirs."
Do i = 1 To fdirs.0
Call SysFileTree fdirs.i||"\*", "files.", "FS"
totalsize = 0
If files.0 > 0 Then Do j = 1 to files.0
Parse Value files.j With . . fsize . files.j
files.j = Strip( files.j )
totalsize = totalsize + fsize
EndSay SubStr( fdirs.i, fdlen + 1 )||"="||totalsize
EndEndExit 0
Syntax:
msg = Arg( 1 )
If msg <> "" Then Do
Say Say msg End SaySay "DiskUse, Version 4.00 for OS/2 and Regina Rexx"
Say "Display diskspace used by current directory and subdirectories"
SaySay "Usage: DISKUSE [ startdir ]"
SaySay "Will use Quercus System's RexxLib if available to sort the listing"
SaySay "Written by Rob van der Woude"
Say "http://www.robvanderwoude.com"
Exit 1
Returnpage last modified: 2025-10-11; loaded in 0.0099 seconds