FileExists Method

 

Description

 

Returns True if the specified file exists; False if it does not.

 

PowerBASIC Syntax

 

METHOD FileExists ( _

BYVAL bstrFileSpec AS STRING _

) AS INTEGER

 

Arguments

 

bstrFileSpec

BSTR. The name of the file whose existence is to be determined. A complete path specification (either absolute or relative) must be provided if the file isn't expected to exist in the current folder.

 

Return Value

 

Boolean. VARIANT_TRUE or VARIANT_FALSE.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM fso AS IFileSystem

DIM iExists AS INTEGER

 

' Create an instance of the FileSystemObject

fso = NEWCOM "Scripting.FileSystemObject"

' Check if the file exists

iExists = fso.FileExists(UCODE$("C:\MyFolder\Test.txt"))

 

Valid XHTML 1.0 Transitional