Click or drag to resize

File Function

Determine if any file matches a given file specification.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.4a
Syntax
 FUNCTION File(
	cFileSpec AS STRING
) AS LOGIC
View Source

Parameters

cFileSpec
Type: String
The file specification for the search.  Besides a file name, this specification can include an optional drive, directory, and extension.
The file name and extension can include the standard wildcard characters (* and ?).
If you do not specify a drive and directory, this function searches only the SetDefault() and SetPath() settings.  Note also that File() does not recognize hidden or system files in its search.If <cFileSpec> is longer than 127 characters and has no path VO searches in the current directory only

Return Value

Type: Boolean
TRUE if any file matches the <cFileSpec> pattern; otherwise, FALSE.
Remarks
Examples
This example illustrates how File() attempts to find files:
X#
1? File("sales.dbf")                    // FALSE
2? File("\apps\dbf\sales.dbf")            // TRUE
3SetPath("\apps\dbf")
4? File("sales.dbf")                    // TRUE
5SetPath("")
6SetDefault("\apps\dbf\")
7? File("sales.dbf")                    // TRUE
8? File("*.dbf")                    // TRUE
See Also