bwrb delete
Delete notes from your vault with safety checks and bulk mode support.
Synopsis
Section titled “Synopsis”bwrb delete [options] [query]Delete operates in two modes:
- Single-file mode (default): Delete a specific note by name/query
- Bulk mode: Delete multiple notes matching targeting selectors
Options
Section titled “Options”Targeting
Section titled “Targeting”| Option | Description |
|---|---|
-t, --type <type> | Filter by type |
-p, --path <glob> | Filter by path glob |
-w, --where <expr> | Filter by frontmatter expression (repeatable) |
-b, --body <query> | Filter by body content search |
-a, --all | Select all notes (required for bulk delete without other targeting) |
Execution
Section titled “Execution”| Option | Description |
|---|---|
-x, --execute | Actually delete files (default is dry-run for bulk) |
-f, --force | Skip confirmation prompt (single-file mode) |
--picker <mode> | Selection mode: auto, fzf, numbered, none |
-o, --output <format> | Output format: text, json |
Safety: Two-Gate Model
Section titled “Safety: Two-Gate Model”Bulk delete requires two explicit gates to prevent accidents:
- Targeting gate: Must specify at least one selector (
--type,--path,--where,--body) OR use--all - Execution gate: Must use
--executeto actually delete (dry-run by default)
# Error: no targeting specifiedbwrb delete# "No files selected. Use --type, --path, --where, --body, or --all."
# Dry-run: shows what would be deletedbwrb delete --type task
# Actually deletesbwrb delete --type task --executeExamples
Section titled “Examples”Single-file Mode
Section titled “Single-file Mode”# Delete specific note with confirmationbwrb delete "My Note"
# Skip confirmationbwrb delete "My Note" --force
# Scripting modebwrb delete "My Note" -o json --forceBulk Mode
Section titled “Bulk Mode”# Preview deletions (dry-run)bwrb delete --type task
# Actually delete all tasksbwrb delete --type task --execute
# Delete all notes in Archivebwrb delete --path "Archive/**" -x
# Delete by contentbwrb delete --body "DELETE ME" --execute
# Delete with frontmatter filterbwrb delete --where "status=archived" --execute
# Delete ALL notes (dangerous!)bwrb delete --all --executePicker Modes
Section titled “Picker Modes”When query is ambiguous (single-file mode):
| Mode | Behavior |
|---|---|
auto | Use fzf if available, else numbered select (default) |
fzf | Force fzf (error if unavailable) |
numbered | Force numbered select |
none | Error on ambiguity (for non-interactive use) |
Recovery
Section titled “Recovery”Deletion is permanent. Use version control (git) to recover deleted notes if needed.
See Also
Section titled “See Also”- bwrb bulk — Batch operations (non-destructive)
- Targeting Model — Selector reference