-
-
Notifications
You must be signed in to change notification settings - Fork 2
Fluid FileSearch API
Paul Manias edited this page May 3, 2024
·
1 revision
The FileSearch interface simplifies the process of searching for files and folders within the file system. Support is provided for both wildcard filters and content searching.
This example searches for text files in the documents:
folder that include the word tennis
:
file.search("documents:", {
nameFilter = "*.txt",
nameWild = true,
contentFilter = "tennis",
matchFeedback = function(Path, FileName, File)
print(Path, " ", FileName)
end
})
Valid options to use when defining the search table are as follows:
Option | Description |
---|---|
nameFilter | Include file/folder names that match this filter. |
contentFilter | Include files that contain this content. |
nameWild | Set to true to enable wildcard matching for file names, or 'lua' for Lua expression matching. |
contentWild | Set to true to enable wildcard matching for content, or 'lua' for Lua expression matching. |
caseSensitive | All comparisons are case sensitive. |
matchFeedback | Call this function each time that a matched file is discovered. Returning ERR_Terminate will stop the search. Synopsis: function(Path, File, Attributes)
|
ignoreFeedback | Call this function each time that a file fails to pass filter matches. |
minSize | Filter out files that do not meet or exceed this minimum size. |
maxSize | Filter out files that exceed this size. |
minDate | Filter out files with a modification time less than this timestamp. |
maxDate | Filter out files with a modification time exceeding this timestamp. |
scanLinks | Allows symbolically linked files and folders to be included in the file search. |
matchFolders | Include matching folder names in the output of the search. |
ignoreFiles | Do not scan files (useful only in conjunction with matchFolders )." |
When searching files for content, it is strongly recommended that a filter or size limit is applied so that only a limited number of files are opened for searching.