Skip to content

undo

fialr undo [options]

Reverse previous file operations. Shows a dry-run preview by default. Supports undoing by job, by operation count, or by specific operation UUIDs.


OptionDescription
--job UUIDUndo all operations from a specific job
--last NUndo the last N operations
--op UUID [UUID ...]Undo specific operation UUIDs
--executeApply the undo (default: dry-run preview)
--forceForce undo even when conflicts are detected

Without --execute, undo previews what would be reversed. Each operation shows the current path and the original path the file would return to. Conflicts are flagged with a reason.

Before executing, undo checks for three types of conflicts:

ConflictDescription
file_existsAnother file now occupies the original path
dir_missingThe original parent directory no longer exists
file_modifiedThe current file hash differs from the operation record

Conflicts are displayed in the dry-run preview. With --force, conflicting operations proceed anyway (overwriting files at the original path). Without --force, conflicting operations are skipped.

With --execute, for each reversible operation (in reverse chronological order):

  1. Verify the file exists at its current location
  2. Check for conflicts at the original location
  3. Move the file back to its original path
  4. Clear provenance XATTRs (original_name, original_path)
  5. Update the paths table (flip is_current flags)
  6. Log the reverse operation to the operations table

Only move, rename, and archive operations can be reversed. Enrichment metadata changes and classification assignments are not reversible via undo.


Dry-run preview:

undo --last 5
UNDO 5 operations (dry-run)
────────────────────────────────────────────────────────
financial/2024-03-15-acme-invoice.pdf
→ Documents/scan001.pdf
financial/2024-01-08-smith-contract.pdf
→ Documents/doc (1).pdf
photos/2024-06-01-paris-eiffel_sunset.jpg
→ Photos/IMG_4521.jpg
⚠ CONFLICT file_exists
medical/2023-11-20-dr_chen-annual_physical.pdf
→ Documents/results.pdf (file exists at original path)
financial/2024-09-12-fidelity-401k_statement.pdf
→ Documents/statement.pdf

Execution:

undo --last 5 --execute
UNDO 4 reversed, 1 skipped
────────────────────────────────────────────────────────
reversed 4
skipped 1 (conflict: file_exists)

Terminal window
# Preview the last 10 reversible operations
fialr undo --last 10
# Undo a specific job
fialr undo --job 2026-03-11_organize_a1b2c3d4
# Undo specific operations by UUID
fialr undo --op abc123 def456
# Execute the undo (apply changes)
fialr undo --last 5 --execute
# Force undo even with conflicts
fialr undo --last 5 --execute --force
# Show all reversible operations (no filter)
fialr undo