Skip to content

Glob

Finds files matching a pattern.

Runtime Comparison

Aspect Claude Code Opencode
Tool name Glob glob
Pattern syntax Standard glob patterns Standard glob patterns
Sort order By modification time By path

Pattern Syntax

Pattern Description
* Match any characters (single level)
** Match any directories (recursive)
? Match single character
[abc] Match any character in set
{a,b} Match either option

Use Glob to find files by name or extension:

  • **/*.ts - All TypeScript files
  • src/**/*.test.js - Test files under src/
  • **/package.json - All package.json files
  • {src,lib}/**/*.ts - TypeScript in src or lib

Combine with Grep for targeted searches: Glob finds files by name, Grep searches their contents.