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

date_modified

Matches files by their last modification time.

Syntax

# Files modified before a relative time
- date_modified:
    before:
      days_ago: 30

# Files modified after a relative time
- date_modified:
    after:
      hours_ago: 24

# Files modified before an absolute date
- date_modified:
    before:
      date: "2024-01-01"

Operators

operatordescription
beforeFile was modified before this time
afterFile was modified after this time

Time specifications

Relative time

optiondescription
seconds_agoSeconds in the past
minutes_agoMinutes in the past
hours_agoHours in the past
days_agoDays in the past
weeks_agoWeeks in the past
months_agoMonths in the past (~30.44 days)
years_agoYears in the past (~365.25 days)

Absolute time

optionformatexample
dateYYYY-MM-DD2024-01-15
dateYYYY-MM-DDTHH:MM:SS2024-01-15T14:30:00
unixUnix timestamp1704067200

Examples

Files older than 30 days

- date_modified:
    before:
      days_ago: 30

Files modified in the last hour

- date_modified:
    after:
      hours_ago: 1

Files modified before 2024

- date_modified:
    before:
      date: "2024-01-01"

Files modified in the last week

- date_modified:
    after:
      weeks_ago: 1

Example: clean old downloads

rules:
  - name: Archive Old Downloads
    locations: ~/Downloads
    filters:
      - date_modified:
          before:
            days_ago: 90
    actions:
      - move: ~/Archive/Downloads