Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

rename

Renames files in place.

Syntax

# Simple form - new name with template
- rename: "${name}_archived${ext}"

# Explicit form with options
- rename:
    new_name: "${name}_%Y%m%d${ext}"
    on_conflict: rename_with_suffix

Options

optiontyperequireddefaultdescription
new_namestringYes-New filename (supports templates)
on_conflictstringNorename_with_suffixHow to handle existing files

Conflict handling

modebehavior
rename_with_suffixAdd numeric suffix (file_2.txt, file_3.txt, etc.)
skipDon’t rename if a file with the new name exists
overwriteReplace existing file with the new name

Examples

Add date suffix

- rename: "${name}_%Y%m%d${ext}"

Preserve original name

- rename: "${name}${ext}"

Add prefix

- rename: "archived_${name}${ext}"

Rename with skip on conflict

- rename:
    new_name: "processed_${name}${ext}"
    on_conflict: skip

Standardize filenames

rules:
  - name: Rename Screenshots
    locations: ~/Desktop
    filters:
      - name: "Screen Shot*"
    actions:
      - rename: "screenshot_%Y%m%d_%H%M%S${ext}"

Template variables

The new_name field supports template variables:

variabledescriptionexample
${name}Filename without extensiondocument
${ext}File extension (with dot).pdf
%YYear (4 digits)2024
%mMonth (01-12)03
%dDay (01-31)15
%HHour (00-23)14
%MMinute (00-59)30
%SSecond (00-59)45

See Templates for full details.

Notes

  • File stays in the same directory
  • Only the filename changes, not the location
  • Default conflict handling adds a numeric suffix (file_2.txt)
  • Use rename and move in succession to rename a file and move it to another directory
  • Template variables are evaluated at the time of action execution