Language Reference Guide : 4. System Classes : SessionObject Class : FileExists Method
 
Share this page                  
FileExists Method
The FileExists method determines whether a file exists.
This method has the following syntax:
integer = SessionObject.FileExists(filename = varchar(256))
This method has the following parameter:
filename
Specifies the filename to check for
The method returns TRUE if the file exists and FALSE otherwise.
The path specification must be appropriate for the operating system. The following example shows how to write an application that runs on both Windows and UNIX systems:
declare
     os        = integer not null;
     file      = varchar(100) not null;
     ret       = integer not null;
enddeclare
{
     os = CurSession.OperatingSystem;
     if (os = SY_UNIX) then
          file = '/ingres/files/olddir/';
     else
          file = 'c:\ingres\files\olddir\';
     endif;
     file = file + 'myfile.txt';
     ret = CurSession.FileExists(filename = file);
     ...
}