FILE_EXISTS()

FILE_EXISTS(F)

RETURNS 1 IF THE FILE F EXISTS, 0 OTHERWISE

  • Type: Function
  • Parameter: 1
  • Group: Files

ACTION

The fonction FILE_EXISTS(F) returns 1 if the file F exists and 0 otherwise. F is the absolute or relative name of the file.

The absolute name is the entire name, related to the root of the file system (ex: "c:\temp\file.txt").

The relative name is the name of the file related to the current directory (ex: "file.txt" or "/file.txt" or "\file.txt").

SYNTAX: Result=FILE_EXISTS(F)

  • F = absolute or relative name of the file.

USE

  • The function FILE_EXISTS() is used to know if a file exists.

ERROR

  • If F is not a correct name of file.

EXAMPLE

rem test if file "aaa.txt" exists

if file_exists("aaa.txt")=1 then print "the file exists"

SEE ALSO

FILE_DELETE

FILE_RENAME