Rules Engine

Create precise, deterministic rules for predictable file organization with exact conditions and actions.

How to organize files automatically. Describe the sorting you want in plain English and Sortio writes readable, editable rules that run locally in milliseconds and use none of your AI allowance.

Open this video on its own page
Video transcript

Sortio's AI sorting is great for a messy folder you tackle once. But for the tidying you do over and over, there's something better, and it costs you no AI allowance at all.

Here's a downloads folder. The usual mix: PDFs, screenshots, app installers, a few spreadsheets. This is the kind of clean-up you end up repeating every few weeks, which makes it a job for a rule rather than the AI.

That's what Automations are. Rules that run in milliseconds, with no AI involved. Which means they're free to run, they use none of your allowance no matter how often you run them, and you can attach one to a Space so files get filed as they arrive.

You don't have to build the rule by hand. You can just describe it. Move every PDF into a Documents folder, every image into Images, and every installer into Apps.

Now, that one sentence is actually three different jobs. And here's the thing worth understanding about automations: every action in a rule runs on every file that rule matches. So if you put all three moves in one rule, every file would get moved three times.

So Sortio doesn't do that. It splits your sentence into separate automations, one per group. This first one is just PDFs to Documents. One condition, one action, and you can read and edit every part of it.

Underneath you choose how it runs. Manually, whenever you like, from Automations, a Space, or the Sort page. Or on a Pro plan, automatically, the moment new files land. There's a dry run too, so you can preview exactly what would happen before anything moves.

I hit save.

And there they are. Three separate automations, from one sentence. PDFs to Documents, Images to Images, Installers to Apps. Each one matching its own group, each one doing exactly one thing. Run them whenever you want, forever, for free.

Overview

The Rules Engine lets you create IF/THEN automation rules that execute the same way every time. Unlike AI sorting which interprets intent, deterministic rules follow exact conditions you specify—perfect for compliance workflows, automated pipelines, and situations where consistency is critical.

AI Sorting

Interprets your intent, handles nuance, adapts to context. Great for flexible organization.

Deterministic Rules

Follows exact conditions, same inputs = same outputs. Great for repeatable workflows.

Building Rules

Rules have three components: conditions, logic operators, and actions.

Rule Builder Steps

1
Basic Info

Set a name, description, and priority (lower numbers run first)

2
Conditions

Define what files to match using field + comparator + value

3
Actions

Specify what to do with matches: move, rename, tag, etc.

4
Test & Enable

Use dry-run to preview results, then enable the rule

Condition Fields

Fields are properties of a file that you can test against. Select a field, then choose a comparator and value.

Field Description Example
name Filename (with extension) invoice_2024.pdf
extension File extension (without dot) pdf
size File size in bytes 104857600 (100MB)
file_type General type category document, image, video
mime_type MIME type application/pdf
created_at File creation date Used with date comparators
modified_at Last modified date Used with date comparators

Comparators

Comparators define how to test a field's value. There are 21 comparators organized by type.

String Comparators

EQUALS Exact match (case-sensitive option available)
NOT_EQUALS Does not match exactly
CONTAINS Value appears anywhere in field
NOT_CONTAINS Value does not appear in field
STARTS_WITH Field begins with value
ENDS_WITH Field ends with value
MATCHES_REGEX Matches regular expression pattern

List Comparators

IN Value is in list (e.g., extension IN ["pdf", "docx"])
NOT_IN Value is not in list

Numeric Comparators

GT Greater than (e.g., size GT 104857600 for >100MB)
GTE Greater than or equal
LT Less than
LTE Less than or equal
BETWEEN Value is between two numbers (inclusive)

Boolean Comparators

IS_TRUE Field value is true
IS_FALSE Field value is false
EXISTS Field has a value (not null/empty)
NOT_EXISTS Field is null or empty

Special Comparators

HAS_TAG File has specific Finder tag (macOS)
MODIFIED_WITHIN Modified in last N days (e.g., "30d")
CREATED_WITHIN Created in last N days

Boolean Logic

Combine multiple conditions using boolean operators. You can nest condition groups for complex logic.

ALL

All conditions must match (AND)

Example: name CONTAINS "invoice" AND extension = "pdf"

ANY

At least one condition must match (OR)

Example: extension = "jpg" OR extension = "png"

NONE

No conditions can match (NOT)

Example: NOT (extension = "tmp" OR extension = "bak")

Nested Groups

Create complex logic by nesting condition groups. For example:

ALL OF:
  - name CONTAINS "invoice"
  - ANY OF:
      - extension = "pdf"
      - extension = "docx"

This matches files with "invoice" in the name that are either PDF or DOCX.

Actions

When a file matches your conditions, one or more actions execute in sequence.

MOVE

Move File

Move file to a destination folder. Supports template variables for dynamic paths.

Archive/{file.created}
RENAME

Rename File

Rename the file using a pattern with template variables.

{file.name}_{file.created}{file.extension}
TAG

Add Tags

macOS only

Add Finder tags to the file. Modes: add (append), set (replace), or remove.

Sortio never deletes files

There is no delete action. If you want files out of the way, move them to a folder such as To Delete and remove them yourself once you have checked them.

Sequential Actions

Actions run in order. Enable "Continue on error" to proceed even if an action fails.

Template Variables

Use template variables in MOVE and RENAME actions to build dynamic paths and filenames.

File Variables

{file.name} Filename without the extension
{file.extension} Extension, including the leading dot
{file.path} Full path to the file
{file.size} File size in bytes
{file.type} MIME type
{file.created} Creation timestamp
{file.modified} Last modified timestamp
{file.opened} Last opened timestamp
{file.content} Extracted text preview, where available
{file.macos.color} Finder color label (macOS)
{file.image.width} Image width in pixels
{file.image.height} Image height in pixels
{file.exif.datetime} Date the photo was taken
{file.exif.make} Camera make
{file.exif.model} Camera model
{file.exif.city} City from photo GPS data
{file.exif.state} State or region from photo GPS data
{file.exif.country} Country from photo GPS data
{file.exif.latitude} GPS latitude
{file.exif.longitude} GPS longitude

Knowledge Graph Variables

These read from the Knowledge Graph, so the folder must be indexed first. Always give them a fallback.

{entity.organization} Organization found in the file by the Knowledge Graph
{entity.person} Person found in the file
{entity.date} Date found in the file

Give every variable a fallback

Add | and a default so files missing that value still have somewhere to go. A file that cannot resolve a variable is skipped and reported; the rest of the run continues.

Invoices/{entity.organization|Unfiled}

Execution Modes

Control when rules run relative to AI sorting in Smart Folders.

BeforeAi

Rules run first. Matched files skip AI sorting. Use for files you always want handled a specific way.

AfterAi

AI sorts first, then rules post-process the results. Use for cleanup or additional organization.

OnlyRules

Skip AI entirely. Only deterministic rules run. Use when you want full manual control.

Disabled

Rules don't run. AI handles everything. This is the default mode.

Priority & Stop on Match

Rules execute in priority order (lower numbers first). Enable "Stop on match" to prevent subsequent rules from processing a file after this rule matches.

Dry-Run & Testing

Always test rules before enabling them with dry-run mode.

Dry-Run Mode

Shows exactly which files match your conditions and what actions would be taken—without actually moving or modifying anything. Review the preview, adjust conditions if needed, then enable the rule when satisfied.

Best Practices

  • • Always dry-run new rules before enabling
  • • Start with simple conditions, add complexity gradually
  • • Set priorities carefully when rules might overlap
  • • Use "Stop on match" to prevent rule conflicts
  • • Check the activity log to verify rules work as expected

Example Rules

Invoice Organization

PDFs containing "invoice" → Finance/Invoices

Conditions: ALL OF
  - name CONTAINS "invoice" (case insensitive)
  - extension IN ["pdf", "docx"]

Actions:
  1. MOVE → Finance/Invoices/{entity.organization|Unfiled}

Screenshot Management

Screenshots → Screenshots, renamed with the date taken

Conditions: ALL OF
  - name STARTS_WITH "Screenshot"
  - extension IN ["png", "jpg"]

Actions:
  1. MOVE → Screenshots
  2. RENAME → {file.name}_{file.created}{file.extension}

Large File Archival

Files over 100MB modified in last 30 days → Archive

Conditions: ALL OF
  - size GT 104857600 (100MB in bytes)
  - modified_at MODIFIED_WITHIN "30d"

Actions:
  1. MOVE → Archive/{file.created}
  2. TAG → ["archived", "large-file"]

Photo Organization by EXIF Date

Organize photos by the date they were taken

Conditions: ALL OF
  - extension IN ["jpg", "jpeg", "png", "heic"]

Actions:
  1. MOVE → Photos/{file.exif.city|Unknown location}