Equinox Online Help - Language Reference - A to Z

Home

FileExists

Applies to
SyntaxFileExists (FileSpecExpression [, AttributeExpression])
Action[Function] Checks whether a file exists
ScopeUsable anywhere
Notes

This statement allows you to search for files, directories and volumes. It searches for the file and path or directory specified by FileSpecExpression and returns true if it exists, otherwise false.

In order to make the file appear on the server, prepend "SERVER:" (in any case) to the FileSpecExpression. This prefix is ignored by the single user version. If the path specification is a relative one, it will start from the program directory - the Eqserver.exe directory for server files, and the Equinox.exe or Equinet.exe directory for everything else.

AttributeExpression is a string containing a list of the file attributes to search for, which defaults to Normal. The list should contain only the first character of the attributes required. The following attributes are supported:

  • N Normal
  • R ReadOnly
  • H Hidden
  • S System
  • V VolumeId
  • D Directory
  • A Archive

The system workarea SysError is set to a non-zero value if an error occurs, otherwise zero.

CategoryFile Management
See Also ChooseFile, FileDelete, FileDetails, FileExists, FileHandle, FilePath, FileRename, FileSearch, FileSearchNext, MakeDirectory, RemoveDirectory
Example

This method looks for a Normal, Archive or Hidden file with the name "test.$$$" and deletes it if found.

if FileExists("c:\data\test.$$$", "NAH") then
FileDelete "c:\data\test.$$$"
end if