Skip to main content
The list-cwd-files command recursively lists all files in the specified directory with options to filter results using glob patterns.

Usage

rev-dep list-cwd-files [flags]

Flags

--cwd
string
default:"$PWD"
Directory to list files from
--include
string[]
Only include files matching these glob patterns
--exclude
string[]
Exclude files matching these glob patterns
--count
boolean
Only display the count of matching files
-h, --help
boolean
Display help for the list-cwd-files command

Examples

List all files in current directory

rev-dep list-cwd-files
Recursively lists all files in the current working directory.

Filter TypeScript files

rev-dep list-cwd-files --include='*.ts'
List only TypeScript files (.ts extension).

Exclude test files

rev-dep list-cwd-files --include='*.ts' --exclude='*.test.ts'
List TypeScript files but exclude test files.

Multiple include patterns

rev-dep list-cwd-files --include='*.ts' --include='*.tsx'
List both .ts and .tsx files.

Multiple exclude patterns

rev-dep list-cwd-files --exclude='*.test.*' --exclude='*.spec.*'
Exclude both test and spec files.

Count matching files

rev-dep list-cwd-files --include='*.ts' --count
Only display the number of TypeScript files without listing them.

List files in specific directory

rev-dep list-cwd-files --cwd ./src
List all files in the src directory.

Complex filtering example

rev-dep list-cwd-files \
  --include='*.{ts,tsx}' \
  --exclude='*.test.*' \
  --exclude='*.spec.*' \
  --exclude='node_modules/**'
List all TypeScript files while excluding tests and node_modules.

How it works

The list-cwd-files command:
  1. Recursively scans - Walks through all subdirectories from the specified path
  2. Applies filters - Matches files against include/exclude glob patterns
  3. Lists results - Outputs matching file paths or count
Glob patterns support wildcards:
  • * matches any characters except /
  • ** matches any characters including /
  • ? matches a single character
  • {a,b} matches either a or b

Use cases

  • File discovery - Find all source files in a directory
  • Quick audits - Count files by type or pattern
  • Script input - Generate file lists for other tools
  • Codebase exploration - Understand project structure
  • Pre-analysis - Identify files before running other rev-dep commands

Build docs developers (and LLMs) love