Description
Prepares for the DirList function, by establishing the default directory and file mask.
Syntax
InitDir expression
Parameters
The InitDir statement has the following parameters.
Parameter | Description |
---|---|
expression | Defines the directory path to the files and specifies the type of files that are to be returned. |
Note: InitDir may take the operating system wild cards "*" and "?".
See also
For more information about directory listings and pathnames, refer to your operating system manual. Also, DirList(), SetInitDirOptions
Example
The following example illustrates how to get a directory listing.
/* The program gets the list of all *.DOC files in the C:\HISTORY\DOCS\LETTERS directory into list variable. It uses InitDir to indicate the directory and DirList() to return the filenames. Note the use of @FM and Col2() within the brackets. */ drive="C:\HISTORY\DOCS\LETTERS" InitDir drive : "*.DOC" loop list = DirList() Until List = "" loop line = list[1,@FM] list[1,Col2()] = "" Until list = "" repeat repeat end
1 Comment
Don Bakke
There is a slight typo in the example code above. The drive variable should have an additional "\" at the end:
Otherwise, the InitDir call will not be fed a well formed path.