tsoqnav1.4.2

Dry runs & plans

Look before you leap. Every command that moves files can show you what it would do instead.

-n / --dry-run#

Add -n to any rename or sort command and tsoqna will read every file, work out every destination, check for conflicts — and then stop.

$ tsoqna rename ~/Pictures/2019-trip -n
  plan  DSCF0412.JPG  -> 2019-05-03_141502.jpg
  plan  DSCF0412.RAF  -> 2019-05-03_141502.raf
  plan  DSCF0413.JPG  -> 2019-05-03_141502-1.jpg   (conflict: suffix)
  keep  2019-05-04_080011.jpg                      (already named)
  skip  map.png                                    (no capture date)
5 files · 3 planned · 1 unchanged · 1 skipped · nothing written (dry run)

The first column is the action: plan, keep (already has the right name), or skip with a reason. Nothing is written to disk during a dry run, not even a journal.

Saving a plan#

For big jobs it is often nicer to review a plan in a file than in a terminal. --plan writes the plan as JSON and implies --dry-run:

tsoqna sort /Volumes/CARD --into ~/Photos --plan import.json
less import.json
{
  "tsoqna_plan": 1,
  "created": "2026-11-02T19:44:10+01:00",
  "mode": "move",
  "items": [
    { "from": "/Volumes/CARD/DCIM/100FUJI/DSCF0412.JPG",
      "to":   "/home/ana/Photos/2019/2019-05/2019-05-03_141502.jpg",
      "date": "2019-05-03T14:15:02", "source": "exif:DateTimeOriginal" }
  ],
  "skipped": [
    { "path": "/Volumes/CARD/map.png", "reason": "no-date" }
  ]
}

Applying a plan#

tsoqna apply import.json

You can edit the file before applying it — delete items you do not want, or change a to path by hand. tsoqna re-checks every item when it applies: if a source file has changed or vanished, or a destination now exists, that item is skipped and reported, and the rest carry on.

To apply only part of a plan, use --only with a glob on the destination path (since 1.4):

tsoqna apply import.json --only "*/2019-05/*"

Machine-readable output#

--format json prints one JSON object per line instead of the human table, which is handy for scripts. --quiet prints only the summary line.

Undo#

Every real run writes a journal file named .tsoqna-journal-<timestamp>.jsonl in the source folder. tsoqna undo reads the newest one and moves everything back:

$ tsoqna undo --list
  #1  2026-11-02 19:47  sort  1,281 files  ~/Downloads/phone-dump
  #2  2026-10-28 08:15  rename  64 files  ~/Pictures/scans
$ tsoqna undo        # reverses #1
$ tsoqna undo 2      # reverses #2

Undo works by moving files back along the journal. If you rename or delete files after a run, undo skips those and tells you which ones. It cannot restore a file you have deleted.

Exit codes#

CodeMeaning
0Everything planned was done (or would be, in a dry run).
1Finished, but some files were skipped.
2Bad arguments or config; nothing was touched.
3Stopped part-way because of --on-conflict fail or an I/O error. The journal is still valid for undo.