'set novalue on' /* force KEXX and its way of SIGNAL ON NOVALUE */
/* Usage: [MACRO] CDEFG [root(s)] */
/* Example: CDEFG H:\ (show biggest files on drive H:) */
/* CDEFG (default is C:\ D:\ E:\ F:\ G:\) */
/* Purpose: Search top 1000 biggest files in given tree(s). */
/* See KHELP SORT why 1000 is a reasonable limit - */
/* on OS/2 this is no problem any you can use fast */
/* macros like TREE.KEX followed by a DIRSORT SIZE */
/* Requires: Kedit 5.0 (Frank Ellermann, 1999) */
'extract /DEFSORT/SHADOW/UNDOING/'
'set defsort size'
DIR = 'C:\ D:\ E:\ F:\ G:\' ; if arg() > 0 then DIR = arg( 1 )
'dir' DIR ; if rc <> 0 then exit RESET( rc )
'all /
/' ; if rc <> 0 then exit RESET( rc )
'set shadow off' ; 'set undoing off'
do DIR = 1 /* use relative DIR line numbers */
'nomsg all //' ; ':0' DIR /* next DIRectory */
if rc <> 0 then leave ; 'refresh' /* show progress */
if right( dirfileid.4(), 1 ) == '*' then iterate /* trunc */
if right( dirfileid.5(), 1 ) == '*' then iterate /* trunc */
'more tag :' || line.1() /* TAG for delete */
'nomsg dirappend "' || dirfileid.1() || '\"' /* TREEs */
'nomsg all ~//' ; ':0 1000 delete *' /* limit */
end
'nomsg all tagged' ; if rc = 0 then 'delete all'
'all' ; 'nomsg tag //' ; 'nomsg locate :0 ~tagged -1'
if rc = 0 then 'emsg' line.1() 'truncated directory id.s skipped'
'set alt 0 0' ; 'forw half' ; exit RESET( 0 )
RESET:
'set shadow' SHADOW.1 ; 'set undoing' UNDOING.1
'set defsort' DEFSORT.1 ; return arg( 1 )