home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Computing 63
/
ac063.adf
/
cinemorphjr.lha
/
SupportFiles
/
file_total.rexx
next >
Wrap
OS/2 REXX Batch file
|
1993-06-08
|
1KB
|
39 lines
/* >>> file_total.rexx <<< *
* Get the sum of the sizes of the *
* files in a directory using the *
* AmigaDOS "list" command. */
IF ~Exists(Arg(1)) THEN DO
SAY "ERROR in filetotal.rexx",
"- Directory does not exist"
RETURN 0
END
dirname = '22'x || Arg(1) || '22'x
/* Temporary store for "list" */
store = 'T:MY_VERY_UNIQUE_TEMPORARY_FILE'
doscom = 'list >'store dirname 'files nohead'
ADDRESS COMMAND doscom
succ = Open(file,store,'r')
total = 0
DO FOREVER WHILE ~Eof(file)
line = Reverse(Readln(file))
/* the following line assumes the standard
"list" command. It is "safer" to read the
string backwards, as this allows for all
filename possibilities */
PARSE VAR line time date flags size name
/* filter out non numbers */
IF ~Datatype(size,'Num') THEN size = 0
total = total + reverse(size)
END
/* The following two lines are only needed for
"correctness", and may slow down the program;
if used, "delete" should be resident. */
/* succ = Close(file) */
/* ADDRESS COMMAND 'delete' store */
RETURN total