-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcdefg.kex
45 lines (40 loc) · 2.54 KB
/
cdefg.kex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'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 C:\ D:\) */
/* 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 and you can use fast */
/* macros like TREE.KEX followed by a DIRSORT SIZE */
/* Bugfix 2008: If a directory name actually starts with a dot */
/* it won't work. The proposed "workaround" in an */
/* older version, add a trailing backslash, causes */
/* a dead loop under unclear conditions related to */
/* long paths with Kedit 5 for DOS and KeditW 1.0. */
/* Caveats: DOS Kedit 5.0 and KeditW 1.0 support only up to */
/* 32 backslashes in a path, deeper subdirectories */
/* are silently ignored. */
/* Requires: Kedit 5.0 or KeditW 1.0 (Frank Ellermann, 1999) */
'extract /DEFSORT/SHADOW/UNDOING/'
'set defsort size' ; 'set undoing off'
DIR = 'C:\ D:\' ; if arg() then DIR = arg( 1 )
'dir' DIR ; if rc <> 0 then exit BYE( rc )
'all /<dir>/' ; if rc <> 0 then exit BYE( rc )
'set shadow off' /* show progress without shadows */
do DIR = 1 /* use relative DIR line numbers */
'nomsg all /<dir>/' ; ':0' DIR /* next DIRectory */
if rc <> 0 then leave ; 'refresh' /* show progress */
if pos( '*', dirfileid.1()) = 0 then do /* no truncation: */
'set lineflag TAG' /* tag processed dir. for delete */
'nomsg dirappend "' || dirfileid.1() || '"' /* DIR TREE */
'nomsg all ~/<dir>/' ; ':0 1000 delete *' /* max 1000 */
end
else 'set lineflag NEW' /* flag truncated dir.s, affects */
end /* only OS/2 or maybe KeditW 1.5 */
'nomsg all tagged' ; if rc = 0 then 'delete all'
'all' ; 'set alt 0 0' ; 'nomsg tag altered'
if rc = 0 then 'emsg TAGged truncated directory id.s skipped'
':0' lscreen.1() % 2 - 2 ; exit BYE( 0 )
BYE: /* reset old SHADOW and DEFSORT: */
'set shadow' SHADOW.1 ; 'set defsort' DEFSORT.1
'set undoing' UNDOING.1 ; return arg( 1 )