2.1.4.16 FindAllFiles: Algorithm for Finding All Files Under a Directory
The inputs for this algorithm are:
RootDirectory: A DirectoryFile ADM element indicating the top-level directory for the search.
This algorithm returns a list of files that are descendants of RootDirectory, including RootDirectory itself.
The algorithm uses the following local variables:
Lists of Files (initialized to empty): FoundFiles, FilesToMerge
Pseudocode for the algorithm follows:
Insert RootDirectory into FoundFiles.
For each Link in RootDirectory.DirectoryList:
If Link.File.FileType is DirectoryFile:
Set FilesToMerge to FindAllFiles(Link.File).
Else:
Set FilesToMerge to a list containing the single entry Link.File.
EndIf
For each File in FilesToMerge:
If File is not an element of FoundFiles, insert File into FoundFiles.
EndFor
EndFor
Return FoundFiles.