Read Me - Common Public License V1.0 - Copyright Notice(©)

listFiles


>>-listFiles---------------------------------------------------><

Returns an array of files/directories which are immediate childrens of the directory denoted by the absolute path of the receiver object. The order in which the names are returned is dependent on the file system (not necessarily alphabetic order). The special names "." and ".." are not returned.

The result is an array of File objects. If the receiver object is not a directory then the result is .nil.

Class FILE - listFiles method


do file over deepListFiles("c:\program files\oorexx\samples")
    say file
end

-- Depth first iteration
::routine deepListFiles
use strict arg directory, accumulator=(.List~new)
files = .File~new(directory)~listFiles
if files == .nil then return accumulator
do file over files
    accumulator~append(file)
    if file~isDirectory then call deepListFiles file~absolutePath, accumulator
end
return accumulator

/* Possible output */
c:\program files\oorexx\samples\api
c:\program files\oorexx\samples\api\callrxnt
c:\program files\oorexx\samples\api\callrxnt\backward.fnc
c:\program files\oorexx\samples\api\callrxnt\callrxnt.c
c:\program files\oorexx\samples\api\callrxnt\callrxnt.exe
c:\program files\oorexx\samples\api\callrxnt\callrxnt.ico
c:\program files\oorexx\samples\api\callrxnt\callrxnt.mak
c:\program files\oorexx\samples\api\callrxwn
c:\program files\oorexx\samples\api\callrxwn\backward.fnc
(etc...)

Read Me - Common Public License V1.0 - Copyright Notice(©)