FVSDK_ERROR_CODE FVSDK_FindFile(FVSDK_Session* pSession, LPCTSTR pszFileName);
Starts a directory listing on the server using LIST, NLST, MLST, or MLSD depending on configuration settings or the capability of the server. When using this command, the server is setup for the data transfer, the listing is performed, and the listing is parsed. Large directories can require a considerable amount of time, however using FVSDK_Stop() will cause this function to exit.
NOTE: Be sure to call FVSDK_FindFileClose() when all file find operations are complete.
pSession
A pointer to the FVSDK_Session that is to perform the operation.
pszFileName
A NULL terminated string containing a file name or wild card to use for searching for a file or receiving a directory listing. For example, "test.txt" can be used to find a single file, or "*.txt" can be used to find all files ending in ".txt". This parameter can be NULL or set to an empty string to receive all files and sub directories.
Examples of wildcards:
* - all files and subdirectories
*.html - files ending with ".html"
*.exe - files ending with ".exe"
?????.html - files consisting of 5 characters, followed by ".html"
[dD]efault.html - either "default.html" or "Default.html"
FVSDK_YES if at least one file or subdirectory matches the pszFileName parameter's search criteria. FVSDK_NO if no files or subdirectories were found. Error codes can be found in FVSDK_ErrorCodes.h.
// find the file or files in the current directory
if (FVSDK_FindFile(pSession, "*") == FVSDK_YES) {
FVSDK_ERROR_CODE fvecRet;
FVSDK_FileInfo FileInfo;
// initialize the file info structure
FileInfo.nVersion = FVSDK_FILE_INFO_CURRENT_VERSION;
FileInfo.nSize = sizeof(FileInfo);
// find each of the files in the current directory
do {
// get the current file information and move to the next file
fvecRet = FVSDK_FindNextFile(pSession, &FileInfo);
// ... perform some operations ...
} while ((fvecRet == FVSDK_YES) && (! FVSDK_LastOperationStopped(pSession)));
} // if
else
AfxMessageBox("No files were found.");
// close the file find operation
FVSDK_FindFileClose(pSession);