Dir Command

Purpose

Prints the contents of a directory.

Syntax

Dir path$ [To file$]

path$:sexp;
file$:sexp; optional file name

Description

Dir path$ returns the directories in path name specified in path$. If path$ ends with a ":" or "\", GFA-BASIC automatically appends "*.*". The default destination for the output of the directory is to screen. The specification of To file$ is optional. It can be used to redirect the directory output to a file or a peripheral device.

Example

OpenW 1

Local x%

Dir "c:\windows\?a.*" To "test.dat"

// if not exist a file will be created and therein all file

// names are placed in, which will be found by using the

// last pattern.

Dir "c:\windows\*.?st" To "test2.dat"

// or

Dir "c:\windows\*.lst" To "Test3.dat"

See Also

Files[To], SplitPath.

{Created by Sjouke Hamstra; Last updated: 24/08/2021 by James Gaite}