Skip to content

FILE_EXISTS ​

FILE_EXISTS checks if the specified files exists. It works with both DB files and file system files.

Syntax ​

leo-grammar
CC "AdoScript" FILE_EXISTS file:strValue

# -->RESULT exists:boolValue
CC "AdoScript" FILE_EXISTS file:strValue

# -->RESULT exists:boolValue

Parameters ​

  • file (strValue) - the name of the file to be checked (including the path)

Returns ​

  • exists (intValue) - is set to 1 (true) if the file exists and to 0 (false) otherwise.

Details ​

Relative paths relate to the current working directory (CWD).
If you check for DB files, you have to prefix the string with db:\\.
FILE_EXISTS checks only for files which are attached to the current application library!

See Also ​

Examples ​

asc
# check if the file version.txt exists in the CWD
CC "AdoScript" FILE_EXISTS file:"version.txt"
IF (exists) {
    CC "AdoScript" INFOBOX "File exists!"
} ELSE {
    CC "AdoScript" INFOBOX "File does not exist!"
}
# check if the DB file reginald.ini exists
CC "AdoScript" FILE_EXISTS file:"db:\\reginald.ini"
IF (exists) {
    CC "AdoScript" INFOBOX "DB-File exists!"
} ELSE {
    CC "AdoScript" INFOBOX "DB-File does not exist!"
}
# check if the file version.txt exists in the CWD
CC "AdoScript" FILE_EXISTS file:"version.txt"
IF (exists) {
    CC "AdoScript" INFOBOX "File exists!"
} ELSE {
    CC "AdoScript" INFOBOX "File does not exist!"
}
# check if the DB file reginald.ini exists
CC "AdoScript" FILE_EXISTS file:"db:\\reginald.ini"
IF (exists) {
    CC "AdoScript" INFOBOX "DB-File exists!"
} ELSE {
    CC "AdoScript" INFOBOX "DB-File does not exist!"
}

Versions and Changes ​

Available since ADOxx 1.3