EXISTS()

 

Syntax:

       Then: EXISTS(filename)

 

Return Values:
"1" if the file exists,
"0" if the file does not exist
a negative number if a system error occurs

 

Note: "fn" can be a file name as well as a directory path.

 

Version Ref:  4.1

Description:

Checks for the existence of a file on the system, where filename is an expression that resolves to either a relative or full pathname.

This command is valuable if you need to make sure a file already exists before you do a particular task, otherwise the task may go into an error condition. This function allows you to avoid such situations. It is also valuable when used as a configuration tool. For example, by placing certain files in a user's environment, you can run processing based on their existence.

 

Examples:

       Then: fn="/"&dp&"/"&4
         If: exists(fn) le "0"
       Then: msgbox "File does not exist." ; goto loop