FExists Function

Action

Checks whether a specified file exists.

If the file name includes a directory name, the file is opened in the specified directory. Otherwise, Silk Performer searches for the file in the directory where the test script is located, in the data directory, in the results directory and in the project directory.

Include file

Kernel.bdh

Syntax

FExists(in sFileName: string): boolean;

Return value

  • true if the file exists

  • false otherwise

Parameter Description
sFileName Name of the file

Example

dcltrans
  transaction TMain
  begin
    // check whether the file "autoexec.bat" exists
    // in the C root directory
    if FExists("c:\\autoexec.bat") then
      write("file autoexec.bat exists"); writeln;
    else
      write("no autoexec.bat file"); writeln;
    end;
  end TMain;

Output

file autoexec.bat exists