AIT_FileExists

Description

Checks whether the file with a specified attribute exists.

Format

integer AIT_FileExists  (
 string strFileName            // Filename
 [,integer nFileAttributes]    // File attribute
);

Parameters

strFileName (input)

Specify the name of a file to be found.

nFileAttributes (input, optional)

Specify a file attribute, which must be one of the following values.

ValueDescription
FILE_ATTRIBUTE_DIRECTORYThe file is a directory.
FILE_ATTRIBUTE_HIDDENThe file is a hidden one.
FILE_ATTRIBUTE_SYSTEMThe file is part of the OS, or is OS-specific.
FILE_ATTRIBUTE_ARCHIVEThe file is an archive one. The application uses this attribute as a mark for file backup or deletion.
FILE_ATTRIBUTE_READONLYThe file is a read-only one. The application can read the file, but cannot program and delete it.

By default, a file is detected independent of the file attribute.

Return values

The return value is 1 if the file exists, and 0 if not. If the function has not been executed successfully, the return value is -1. If -1 has been returned, you can use AIT_GetLastError to acquire an extended error code. The following gives the error codes that AIT_GetLastError might return:

Extended error numberError code
2ERROR_FILE_NOT_FOUND
3ERROR_PATH_NOT_FOUND
5ERROR_ACCESS_DENIED
6ERROR_INVALID_HANDLE
8ERROR_NOT_ENOUGH_MEMORY
14ERROR_OUTOFMEMORY
15ERROR_INVALID_DRIVE
21ERROR_NOT_READY
53ERROR_BAD_NETPATH
87ERROR_INVALID_PARAMETER
112ERROR_DISK_FULL
123ERROR_INVALID_NAME
148ERROR_PATH_BUSY
161ERROR_BAD_PATHNAME
998ERROR_NOACCESS
1005ERROR_UNRECOGNIZED_VOLUME
1210ERROR_INVALID_COMPUTERNAME
1214ERROR_INVALID_NETNAME
1231ERROR_NETWORK_UNREACHABLE