Prints or saves a list of files and/or subdirectories with names matching a specified mask (D.B. Baird).
|What to print (
||Whether to include the path in
||The type of mask specified by
||Mask identifying the files that are to be included in the each listing, if no directory path is included, the current working directory is searched; default
||Saves the list of files that match each mask|
||Saves the list of subdirectories that match each mask|
DIRECTORY obtains lists of files or subdirectories matching a specified template. The file and subdirectory lists can be saved in the texts supplied by the
SUBDIRECTORIES parameters respectively. The
SAVEPATH option controls whether the filenames also include the path.
Printed output is controlled by the
||to print the list of files, and|
||to print the subdirectories.|
The template is specified in a text with a single value, using the
MASK parameter. It uses the standard conventions of the DOS
DIR command but, for convenience, you can put
/ instead of \, as in other Genstat file specifications. So, for example, you can list the files with a suffix .GEN in the folder (or directory)
c:\genprog by putting either
(The doubling of each symbol \
within the string is required as usual to tell Genstat that it should not be treated as the continuation symbol.) If no directory is specified in the template (e.g.
MASK='*.gen'), the current working directory is searched.
MASKTYPE option is set to
directory then the
MASK parameter is interpreted as being a directory, and all the files or subdirectories within this directory are returned. For example the following program prints and saves all the files within the subdirectories of the current working directory
DIRECTORY [PRINT=*;MASKTYPE=directory] CDir; SUBDIRECTORIES=Subs
FOR [INDEX=i] SD=#Subs
CONCAT [NEWTEXT=SDir] CDir,'/',SD
DIRECTORY [MASKTYPE=directory] SDir; FILE=Files[i]
The file list is obtained by a call to
SUSPEND with a