Skip to content

Search syntax

Christian Boxdörfer edited this page Aug 16, 2022 · 13 revisions

Normal and wildcard search (FSearch 0.2 and later)

Operators

Operator Keyword Description
AND space, AND, && An AND operator combines two search terms. Only results that match both search terms are returned.
OR OR, || An OR operator combines two search terms. Results that match one or both search terms are returned.
NOT NOT, ! A NOT operator negates the following search term.
Grouping (, ) Search terms can be surrounded by parentheses to group them together.

Wildcards

Keyword Description Example
* Matches zero or more characters *.pdf finds document.pdf but also .pdf
? Matches exactly one character k?ng finds king, kong, kung, k1ng, etc.

Modifiers

Modifiers can be applied to a search term. They can also be chained: folder:case:exact:(backup OR archive). They're currently evaluated from left to right, but this might change in future updates.

Keyword Description Example
case:
nocase:
Match case
ignore case
case:Test finds TestDocument.odt but not testdocument.odt

nocase:test finds TestDocument.odt and testdocument.odt
exact: Exact match exact:test finds Test and test but not testdocument.odt
file:
files:
Match files only file:test finds a file named test.odt but won't find the folder testfolder
folder:
folders:
Match folders only file:test finds a folder named testfolder but won't find the file test.odt
path:
nopath:
Match the full path
Match only the file/folder name
path:home finds a folder named home and all its children
regex:
noregex:
Enable regular expression
Disable regular expression

Note: All reserved characters used by the FSearch search syntax (e.g. (, ), \) need to be escaped properly when they're used in the regular expression. This can be achieved by surrounding the whole expression with double quotes ".
file:regex:".+\.pdf$" finds all files which have the pdf extension

Functions

Keyword Description Example
childcount:<num> Search for all folders which have <num> children childcount:1 finds all folders which only contain one file or folder
childfilecount:<num> Search for all folders which have <num> files as children childfilecount:<=4 finds all folders which contain 4 files or less and any number of folders
childfoldercount:<num> Search for all folders which have <num> folders as children childfoldercount:10..20 finds all folders which contain 10 to 20 folders and any number of files
contenttype:<string> Match the content type of files and folders
The content type is the mime type of a file

Note: Determining the content type of a file is an expensive operation and can take a long time. It's therefor advised to first narrow down the potential results (e.g. path:/mnt/backup/documents contenttype:pdf)
contenttype:text finds all text files, like text/plain or text/css
datemodified:<date>
dm:<date>
Search for all files and folders which have been modified at dm:2020 finds all files and folders which have been modified in 2020
depth:<num>
parents:<num>
Search for all files and folders with the specified folder depth depth:0 finds the root folders
empty: Search for all folders which are empty
ext:<semicolon-seperated-list> Search for files with the specified extensions ext:jpg;png;gif
parent:<path> Search for all files and folders which are stored in the folder specified by <path> parent:/home/user
size:<size> Search for all files and folders with the size specified by <size> size:1Mb, file:size:>20gb, file:size:0

Function parameter format

<num>

  • function:<number: less than number
  • function:>number: greater than number
  • function:<=number: less than or equal tonumber
  • function:>=number: greater than or equal to number
  • function:=number: exactly equal to number
  • function:number1..number2: in between number1 and number2

<size>

Same format as <num>, but also supports size suffixes:

  • k, K, kb, KB: kilobyte
  • m, M, mb, MB: megabyte
  • g, G, gb, GB: gigabyte
  • t, T, tb, TB: terabyte

Escaping

Sequence Description Example
Double quotes Everything in between "" is treated literally (like spaces) "/home/user/my folder" *.pdf/home/user/my folder AND *.pdf
Backslash \ escapes the following character (like space or ") /home/user/my\ folder \"quote\".txt/home/user/my folder AND "quote".txt

Regular expression search

TODO

Clone this wiki locally