Skip to main content

Overview

Find files with intelligent filtering and gitignore support. Produces compact tree-style output instead of verbose line-by-line results.

Syntax

rtk find [OPTIONS] [PATH] [EXPRESSION]

Options

Supports both RTK-specific and native find syntax:
pattern
string
Glob pattern to match (e.g., *.rs, test_*.py)
path
string
default:"."
Directory to search in
-name <pattern>
string
Native find: match filename pattern
-type <type>
string
Native find: file type (f=file, d=directory)
-maxdepth <n>
number
Native find: maximum search depth

Examples

Find by Pattern

rtk find "*.rs"
Output:
Found 42 files:
src/
  main.rs
  lib.rs
  utils.rs
tests/
  integration.rs
  unit.rs
... +37 more

Find with Native Syntax

rtk find . -name "test_*.py" -type f

Limit Depth

rtk find "*.md" . -maxdepth 2

Features

  • Gitignore-aware: Automatically skips files in .gitignore
  • Grouped output: Files organized by directory
  • Truncation: Large result sets show summary with file count
  • Dual syntax: Supports both simple glob patterns and native find flags

Token Savings

Average token reduction: 80% For large projects with 1000+ matches, shows first 50 files + count summary instead of full list.

Implementation

Source: src/find_cmd.rs Uses ignore crate for gitignore support and intelligent file traversal.