Finds a file that matches a specified search criteria. To find a list of files, you need to first call this function with the required path and mode (to find the first file), then call the function again with an empty path and a mode of 0 (to find the remaining files). After the last file is found, an empty string is returned.
If the search is for multiple files, FileFindClose needs to be called if the search does not run to completion (for example, you do not run until an empty string is returned).
The name of the file to check. To search for multiple files, the wildcards * and ? can be used to match multiple entries.
The type of file to check:
0 - Normal files (includes files with read-only and archived attributes)
1 - Read-only files only
2 - Hidden files only
4 - System files only
16 - Subdirectories only
32 - Archived files only
128 - Files with no attributes only
These numbers can be added together to search for multiple types of files during one search.
The full path and filename. If no files are found, an empty string is returned.
FileOpen, FileSplitPath, FileMakePath
! Search for all dBase files in the run directory and make a backup
sPath = FileFind("[run]:\*.dbf", 0);
WHILE StrLength(sPath) > 0 DO
FileSplitPath(sPath, sDrive, sDir, sFile, sExt);
sBak = FileMakePath(sDrive, sDir, sFile, "BAK");
FileCopy(sPath, sBak, 0);
! Find the next file
sPath = FileFind("", 0);