Skip to content

ordr clean

Moves files matching your rules into their configured destinations. Creates destination directories automatically.

Terminal window
ordr clean [directory] [flags]

If directory is omitted, the current working directory is used.


Flags

FlagShortDefaultDescription
--dry-run-nfalsePreview what would happen without moving anything
--recursive-rfalseRecurse into subdirectories
--global-gfalseAlso process rules that have explicit scope.dirs defined
--rule <name>Run only the rule with this name
--yes-yfalseSkip all confirmation prompts
--verbose-vfalseShow each file evaluated, not just moved files

Behavior

  1. Loads and merges config (local .ordrrc + global ~/.ordrrc)
  2. Warns if the target directory is a git repo (requires --yes or confirmation)
  3. Builds an execution plan without touching the filesystem
  4. Prints the plan and asks for confirmation (unless --yes)
  5. Executes moves and saves them to ~/.ordr/undo.json

Examples

Terminal window
# Clean current directory (with confirmation)
ordr clean
# Clean Desktop without confirmation
ordr clean ~/Desktop --yes
# Preview only — nothing is moved
ordr clean ~/Desktop --dry-run
# Clean recursively
ordr clean ~/Downloads --recursive
# Run only the "PDFs" rule
ordr clean ~/Desktop --rule "PDFs to documents"
# Verbose: show every file evaluated
ordr clean ~/Desktop --verbose

Output

Plan — 3 file(s) to move
~/Desktop/invoice.pdf → ~/Desktop/documents/invoice.pdf [PDFs to documents]
~/Desktop/photo.png → ~/Desktop/images/photo.png [Images]
~/Desktop/backup.zip → ~/Desktop/archives/backup.zip [Archives]
12 file(s) skipped (no matching rule)
? Move 3 file(s)? (Y/n)
✓ Moved 3 file(s). Run 'ordr undo' to reverse.

Conflict resolution

When a file already exists at the destination, the rule’s options.on_conflict setting applies:

ValueBehavior
rename (default)Appends (1), (2), etc. to the filename
skipLeaves the file in place
overwriteReplaces the existing file

See Rule options for details.