home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
164.lha
/
ARexx
/
Example_ARexx
/
du.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1988-04-28
|
912b
|
45 lines
/* du.rexx -- list disk usage within a directory - by Larry Phillips */
arg root
if right(root,1) ~= ':' then
root = root || '/'
if root = '/' then root = ''
files = 0
bytes = 0
blocks = 0
say
temp = dolist(root)
if root = '' then
say 'Current directory -' temp
else
say root temp
say
say 'Totals:' bytes 'bytes,' blocks 'blocks, ',
files 'files.'
exit 0
dolist: procedure expose bytes blocks files
parse arg x
dirbytes = 0
contents = showdir(x);
do i = 1 to words(contents)
temp = x || word(contents,i)
type = statef(temp)
if word(type,1) = 'FILE' then
do
files = files + 1
bytes = bytes + word(type,2)
blocks = blocks + word(type,3) + 1
dirbytes = dirbytes + word(type,2)
end
if word(type,1) ='DIR' then do
temp2 = dolist(temp || '/')
if temp2 > 0 then do
call writech(stdout,temp || ' - ')
say temp2
end
end
end
return dirbytes