Skip to content

Skip files you don't want indexed

Drafts, build output, and editor droppings don't belong in your tables. ignore globs exclude files entirely — from the initial scan and from watch events alike.

1. Add ignore patterns

Suppose finished notes live in notes/, but drafts and scratch files hide among them:

notes/final.md
notes/drafts/wip.md
notes/scratch.md.tmp

Exclude the noise in .dirsql.toml:

toml
[dirsql]
ignore = ["notes/drafts/**", "**/*.tmp"]

[[table]]
ddl  = "CREATE TABLE notes (path TEXT)"
glob = "notes/**/*"

Patterns match against root-relative paths, the same way table globs do. An ignored file never reaches any table — even one whose glob would match it.

2. Confirm what made it in

Pass the config with -c (dirsql does not auto-load a .dirsql.toml from the current directory):

bash
dirsql query "SELECT path FROM notes ORDER BY path" -c ./.dirsql.toml
json
[{"path":"notes/final.md"}]

Notes

  • ignore lives in a config file, so it needs one: default mode indexes everything with no ignores.
  • The top-level .dirsql/ directory is always excluded, ignore list or not — it is reserved for dirsql's own metadata (config reference).
  • Narrow table globs are the other half of the story: a file matching no table's glob contributes no rows either. Use ignore for things that should never be looked at; use precise globs to shape what each table sees (Define tables for your files).
  • Embedding dirsql instead? The SDK constructor takes the same patterns via its ignore parameter (SDK reference).

Released under the MIT License.