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.2a
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#
? File("sales.dbf")                                        // FALSE
? File("\apps\dbf\sales.dbf")                        // TRUE
SetPath("\apps\dbf")
? File("sales.dbf")                                        // TRUE
SetPath("")
SetDefault("\apps\dbf\")
? File("sales.dbf")                                        // TRUE
? File("*.dbf")                                        // TRUE
See Also