`

Description:

baFindFirstFile searches for the first file matching a specification.

Platforms:

Windows and Macintosh

Usage:

Result = baFindFirstFile( StartDir, FileSpec )

Arguments:

String, string.
StartDir is the directory to start searching in.
FileSpec is the pattern to search for.

Returns:

String.
Returns the full path to the first file found

Examples:

Director:
file = baFindFirstFile( "c:\", "netscape.exe" ) -- searches drive c for netscape.exe

Authorware:
file := baFindFirstFile( "c:\\windows", "*.ttf" ) -- searches for fonts
 

Notes:

All sub-directories of the starting directory will be included in the search. This function can be used with baFindNextFile to find all files.

On Windows, you can use standard DOS wildcard searching.

On Macintosh, if the FileSpec starts with *, then all files with FileSpec in the name will be found, otherwise only exact matches will be returned.

Here are examples of searching the C drive for all copies of "netscape.exe"

Director:

fileList = [] -- a list to contain the found files
file = baFindFirstFile( "c:\", "netscape.exe" )
   -- loop through all found files and add to the list
   repeat while file <> ""
   append( fileList, file )
   file = baFindNextFile()
end repeat
baFindClose()

Authorware:

fileList := [] -- a list to contain the found files
file := baFindFirstFile( "c:\\", "netscape.exe" )
repeat while file <> ""
   AddLinear( fileList, file )
   file := baFindNextFile()
   end repeat
baFindClose()
 

See also:

baFindNextFile
baFindClose