Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Filter Syntax

Filters select sources based on facts using a boolean expression language. Most commands accept --where to filter which sources they operate on. Multiple --where flags are combined with AND.

Operators

Basic

SyntaxMeaning
key?Fact exists
key=valueFact equals value (case-sensitive)
key!=valueFact doesn’t equal value (case-sensitive)
key~patternGlob pattern match (case-sensitive)
key!~patternGlob pattern doesn’t match
key>valueGreater than (numbers/dates)
key>=valueGreater or equal
key<valueLess than
key<=valueLess or equal
key IN (v1, v2, ...)Fact matches any value in list
key NOT IN (v1, v2, ...)Fact doesn’t match any value in list

Glob Patterns

The ~ operator supports shell-style glob patterns:

PatternMeaning
*Match zero or more characters
?Match exactly one character
[abc]Match any character in set
[a-z]Match character range
[!abc]Match any character NOT in set
\*Literal asterisk (escape)
# Files starting with IMG_
--where 'filename~"IMG_*"'

# Files with 3-letter extension
--where 'source.ext~"???"'

# Files in a year subdirectory
--where 'source.rel_path~"*/2024/*"'

# Exclude temp files
--where 'filename!~"*.tmp"'

Boolean Operators

SyntaxMeaning
expr AND exprBoth conditions must match
expr OR exprEither condition matches
NOT exprNegates the condition
(expr)Grouping for precedence

Operator precedence (highest to lowest): NOT, AND, OR. Use parentheses to override.

Using Modifiers

Modifiers can be applied to fact keys using the | syntax. See Facts for the complete list.

# Files from 2024
--where 'source.mtime|year=2024'

# January photos
--where 'content.DateTimeOriginal|month=1'

# Case-insensitive extension matching
--where 'source.ext|lowercase=jpg'

# Case-insensitive glob
--where 'filename|lowercase~"img_*"'

Examples

# Files with a content hash
--where 'content.hash.sha256?'

# Files missing a content hash
--where 'NOT content.hash.sha256?'

# JPG files only
--where 'source.ext=jpg'

# JPG or PNG files
--where 'source.ext=jpg OR source.ext=png'

# Common image formats
--where 'source.ext IN (jpg, png, gif, webp)'

# Exclude certain extensions
--where 'source.ext NOT IN (tmp, bak, log)'

# Not temporary files
--where 'NOT source.ext=tmp'

# iPhone photos (content. prefix is optional)
--where 'Make=Apple'

# Files larger than 1MB
--where 'source.size>1000000'

# Files modified in 2024 or later
--where 'source.mtime>=2024-01-01'

# Large images (combining with parentheses)
--where '(source.ext=jpg OR source.ext=png) AND source.size>1000000'

# Multiple --where flags combine with AND
--where 'source.ext=jpg' --where 'content.Make=Apple'