PmWiki/rexx/regina2.rexx
/* rexx regina */
say 'hier bin ich regina2.rexx regina' time() date('s')
parse arg a
say 'fStat' a':' stream(a, 'c', 'fStat')
if a <> '' then
say a '==stream=>' stream(a, 'c', 'query exists')
c = 'ls -p .' /* '/wkData/inf/cs/save1611/s*1' */
address system c with output replace stem q.
say 'fileList' fileList(abc, './../rexx/././h*') m.abc.0 m.abc.dir.0
do i=1 to m.abc.0
say i m.abc.i
end
do i=1 to m.abc.dir.0
say 'dir' i m.abc.dir.i
end
say 'exists(regina2.rexx)' stream('regina2.rexx', 'c', 'query exists')
say 'exists(tst)' stream('tst', 'c', 'query exists')
say 'exists(.)' stream('.', 'c', 'query existS')
do i=1 to q.0
say i '<'q.i'>'
end
say 'end of rexx'
return
fileList: procedure expose m.
parse arg m, aDi
fs = stream(aDi, 'c', 'fStat')
if word(fs, 8) \== 'Directory' then
call err aDi 'not a Direcotry, fStat:' fs
a = stream(aDi, 'c', 'query exists')
address system 'ls -1p' aDi with output replace stem q.
dx = 0
fx = 0
do qx=1 to q.0
f = copies(a'/', \ abbrev(q.qx, '/'))q.qx
if right(q.qx, 1) \== '/' then do
fx = fx+1
m.m.fx = f
end
else do
dx = dx+1
m.m.dir.dx = f
end
end
m.m.0 = fx
m.m.dir.0 = dx
return fx