home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
coders
/
arexx
/
misc_arexx
/
getdir.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-10-15
|
2KB
|
85 lines
/*
$VER: GetDir.rexx 1.0 (12.Sep.96)
GetDir v1.0 by Fini 'Warp' Alring / GiGA Prod. ©1996
Purpose: to list a dir into an array called Files.
Supports AmigaDOS pattern parsing! :·)
Sorts the files, in alpha order!
Use the function, but remember the credits! ;·D
Getdir makes use of C:List and C:Sort.
*/
Parse arg Source
if ~show('l','rexxsupport.library') then do
call addlib('rexxsupport.library',0,-30,0)
end
Files. = ''
Num_Files = GetDir(Source)
say
do i = 1 to Num_files
say files.i
end
say ; Say 'Number of files:'Num_files
exit(0)
/* ///////////////Program End///////////////// */
/* /////////////Functions Begin///////////// */
GetDir: Procedure Expose Files.
Parse Arg SourceDir
File_count = 0
Address Command 'C:List >NIL: 'SourceDir' TO T:Mfile1.tmp FILES LFORMAT "%s"'
Filesize = word(statef('T:Mfile1.tmp'),2)
if value(filesize) > 0 then Address Command 'C:Sort T:Mfile1.tmp T:Mfile2.tmp CASE >NIL:'
Success = Open(DATA,'T:Mfile2.tmp','Read')
if success = 1 then do
f = 1
Do while eof(DATA) ~= 1
Files.f = Readln(DATA)
f = f + 1
end
Call Close(DATA)
Address Command "C:Delete T:Mfile2.tmp Quiet"
f = 1
do while length(Files.F)>1
File_count = File_count + 1
F = F + 1
end
end
Address Command "C:Delete T:Mfile1.tmp Quiet"
Return File_count