Documentation
Back to website >

FileExists (Pascalscript)

Description

This function checks whether the specified file exists and returns the result true if the file exists. If the file does not exist, the result is false.

Syntax

function FileExists(const s:String): boolean;

Arguments

A file name is specified in the string s. This can contain drive identifier and path or access the file via a UNC path.

Example

begin
  if FileExists('C:\autoexec.bat') then
    ShowMessage('File Autoexec exists')
  else
    ShowMessage('File Autoexec does not exist');
end;

Rules to understand the script can be found here.

This example checks whether the root contains a file named AUTOEXEC.BAT. The confirmation depends on the existence of the file. If this is found there, the message "File Autoexec exists" is displayed.

ShowMessage shows: File Autoexec exists