Job Management Partner 1/Software Distribution Automatic Installation Tool Description and Reference

[Contents][Glossary][Index][Back][Next]

AIT_FindFirstFile

Description

Uses a file search handle to return the first filename that matches a specified filename.

Format

bool AIT_FindFirstFile  (
  string strFileNamePattern,    // Filename
  string strFileName,           // Found filename
  integer nSearchHandle         // File search handle
);

Parameters

strFileNamePattern (input)

Specify a valid directory name, path or filename. You can also use a wildcard (*). If the character string ends with the wild card, period or directory name, the user must be authorized to access all the subdirectories on the path.

strFileName (output)

Specify a variable for receiving the name of a found file that matches a set filename. When the function returns, the variable stores the found filename.

nSearchHandle (output)

Specify a variable for receiving a file search handle to be used to subsequently find AIT_FindNextFile and AIT_FindCloseFile. When the function returns, the variable stores the file search handle.

Return values

The return value is true if the function was executed normally, and false if not. If the function has returned false, you can use AIT_GetLastError to acquire an extended error code. The following gives the error codes that AIT_GetLastError may return.

Extended error number Error code
2 ERROR_FILE_NOT_FOUND
3 ERROR_PATH_NOT_FOUND
5 ERROR_ACCESS_DENIED
6 ERROR_INVALID_HANDLE
8 ERROR_NOT_ENOUGH_MEMORY
14 ERROR_OUTOFMEMORY
18 ERROR_NO_MORE_FILES
21 ERROR_NOT_READY
112 ERROR_DISK_FULL
123 ERROR_INVALID_NAME
148 ERROR_PATH_BUSY
1005 ERROR_UNRECOGNIZED_VOLUME
1210 ERROR_INVALID_COMPUTERNAME
1214 ERROR_INVALID_NETNAME
1231 ERROR_NETWORK_UNREACHABLE

Notes

This function uses only a filename to find the file. It cannot use an attribute to find the file. Independent of the presence or absence of subsequent \, you cannot specify the root directory as a strFileName input character string for AIT_FindFirstFile.

Use AIT_FindCloseFile to close a file search handle returned by AIT_FindFirstFile.