Skip to content

Search syntax

Christian Boxdörfer edited this page Aug 23, 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

<date>

Same format as <num>, but instead of numbers you can combine with >=, >, .., etc., you need to use dates and date constants:

  • today, yesterday

  • mon|day, tue|sday, wed|nesday, thu|rsday, fri|day, sat|urday, sun|day

  • jan|uary, feb|uary, mar|ch, apr|il, may, jun|e, jul|y, aug|ust, sep|tember, oct|ober, nov|ember, dec|ember

  • y, y-m, y-m-d, y-m-d H, y-m-d H:M, y-m-d H:M:S

  • <last|inthelast|prev|previous|this><year|month|week|day|hour|min|minute|sec|second>

  • <last|inthelast|prev|previous><number><years|months|weeks|days|hours|min|minutes|sec|seconds>

where <number> can also be spelled out: one, ..., ten, dozen, hundred

So an example would be: dm:lastfiveweeks..yesterday

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