FileExists

Description

Reports whether the specified file exists.

Syntax

FileExists ( filename )

Argument

Description

filename

A string whose value is the name of a file

Returns

Boolean. Returns true if the file exists, false if it does not exist. If filename is null, FileExists returns null.

Usage

If filename is locked by another application, causing a sharing violation, FileExists also returns false.

Examples

Example 1

This example determines if the file the user selected in the Save File window exists and, if so, asks the user if the file can be overwritten:

string ls_docname, ls_named

integer li_ret

boolean lb_exist


GetFileSaveName("Select File," ls_docname, &

		ls_named, "pkl", &

			"Doc Files (*.DOC),*.DOC")


lb_exist = FileExists(ls_docname)

IF lb_exist THEN li_ret = MessageBox("Save", &

		"OK to write over" + ls_docname, &

			Question!, YesNo!)

See also