FSF.FarRecursiveSearch

Far Manager

FarRecursiveSearch

The FSF.FarRecursiveSearch function is used to find a file in a directory tree with a name matching the given mask.
void WINAPI FarRecursiveSearch(
  const char *InitDir,
  const char *Mask,
  FRSUSERFUNC UserFunc,
  DWORD Flags,
  void *Param
);

Parameters

InitDir
Name of the directory where you want to start the search. ("c:\far\plugins" for example).
Mask
File mask to search for. Starting with FAR 1.70 beta 4, all standard features of FAR masks (multiple masks, character ranges, exclude masks and so on) are supported (see File masks).
UserFunc
Pointer to a user-defined callback function of FRSUSERFUNC type that is called for every found file. This function have to return TRUE to continue the search or FALSE to stop it.
Flags
Can be a combination of the following flags (FRSMODE enumeration):
FlagDescription
FRS_RETUPDIR When the search is stopped, the FullName parameter of the UserFunc function will contain the directory name where the file is found, instead of the name of the file.
FRS_RECUR Recurse the directory tree while searching for the specified file.
FRS_SCANSYMLINK The search will follow symbolic links just as if they were directories.
If one of the scanned symbolic links is a "recursive" one (for example, symbolic link points to one of it's root directories) the search will continue until the maximum allowed length of the full path string will be reached.
Param
Application-defined value to be passed to the callback function specified in the UserFunc parameter.

Return value

None.

Remarks

  1. If you want to use the data passed in the parameters of the UserFunc function after the search is complete, you must copy it to an internal variable.
  2. In FAR versions up to and including 1.70 beta 3 the "*" Mask is to be used if you want to find all files.
  3. In FAR versions up to and including 1.70 beta 3, when doing recursive search, the file mask given in the Mask parameter is also used to determine the directories searched. So, if you want to find a file recursively, in most cases you should pass "*" in the Mask parameter and use the callback function to stop the search when the needed file is found.
  4. If the FRS_SCANSYMLINK flag is not set, symbolic links will not be parsed, in no dependence of FAR configuration.