Skip to main content

A CLI tool to display folder structure and contents with gitignore-style filtering

Project description

folder-crawl

folder-crawl is a powerful command-line tool that displays directory structure and file contents with gitignore-style pattern matching. Perfect for sharing codebases with LLMs, documentation, or quick project exploration.

Features

  • 📁 Display directory tree structure with file sizes
  • 📝 Show contents of text files inline
  • 🎯 Gitignore-style pattern matching via pathspec
  • 🔍 Automatic .foldercrawlignore support, opt-in .gitignore
  • 🚫 Smart default ignores (node_modules, pycache, etc.)
  • 👁️ Optional hidden file inclusion
  • ⚡ Configurable output limits and depth
  • 🎨 Clean, readable markdown-compatible output

Installation

Install from source:

git clone https://github.com/juliusolsson/folder-crawl.git
cd folder-crawl
pip install .

Or install in development mode:

pip install -e .

Quick Start

# Display current directory with default ignores
folder-crawl

# Display specific directory
folder-crawl /path/to/project

# Ignore additional patterns
folder-crawl -I "*.log|*.tmp|cache/"

# Show hidden files
folder-crawl --hidden

# Structure only (no file contents)
folder-crawl --no-contents

# Limit depth
folder-crawl --max-depth 2

Usage

folder-crawl [OPTIONS] [PATH]

Arguments

  • PATH: Directory to crawl (default: current directory)

Options

Option Description
-I, --ignore PATTERN Gitignore-style patterns (pipe-separated or multiple flags)
--set-default Save the -I/--ignore patterns to .foldercrawlignore
--ignore-file PATH Path to ignore file (can be repeated)
--gitignore Also read .gitignore patterns (opt-in)
--no-default-ignore Don't use default patterns and .foldercrawlignore
--hidden Include hidden files and directories
--no-contents Show structure only, no file contents
--max-bytes N Max bytes to display per file (default: 50000)
--max-file-size N Max file size to process (default: 1000000)
--max-depth N Maximum directory depth to traverse
-v, --version Show version

Examples

Basic Usage

# Current directory with smart defaults
folder-crawl

Custom Ignore Patterns

# Multiple patterns with pipe separator
folder-crawl -I "*.log|*.tmp|cache/"

# Multiple -I flags
folder-crawl -I "*.log" -I "*.tmp" -I "cache/"

# Use custom ignore file
folder-crawl --ignore-file .myignore

# Save patterns as default for this directory
folder-crawl -I "__pycache__|*.pyc|build/|*.egg-info/" --set-default .

# Future runs will use the saved patterns automatically
folder-crawl .

Control What's Displayed

# Include hidden files (.env, .git, etc.)
folder-crawl --hidden

# Structure only, no file contents
folder-crawl --no-contents

# Limit content output per file
folder-crawl --max-bytes 10000

# Limit directory traversal depth
folder-crawl --max-depth 2

Working with Git Projects

# Default: uses .foldercrawlignore but NOT .gitignore
folder-crawl

# Opt-in to also use .gitignore
folder-crawl --gitignore

# Skip all default ignores (including .foldercrawlignore)
folder-crawl --no-default-ignore

Ignore Patterns

folder-crawl uses gitignore-style patterns powered by pathspec:

  • *.log - Match all .log files
  • cache/ - Match directories named cache
  • **/test_*.py - Match test files in any directory
  • !important.log - Negate pattern (include important.log)

Pattern Priority

  1. Command-line patterns (-I flags)
  2. Custom ignore files (--ignore-file)
  3. .gitignore (only when --gitignore is specified)
  4. .foldercrawlignore (unless --no-default-ignore)
  5. Default patterns (unless --no-default-ignore)

Default Ignore Patterns

By default, folder-crawl ignores:

  • Version control: .git/, .svn/, .hg/
  • Dependencies: node_modules/, venv/, *.egg-info/
  • Build artifacts: dist/, build/, __pycache__/
  • IDE files: .idea/, .vscode/, *.swp
  • OS files: .DS_Store, Thumbs.db
  • Compiled: *.pyc, *.pyo, *.so, *.dll

.foldercrawlignore

Create a .foldercrawlignore file in your project root for project-specific ignores:

# Custom project ignores
data/
*.secret
config/local.yml
temp/

Output Format

folder-crawl produces clean, markdown-compatible output:

📁 /path/to/project
============================================================

## Structure:

project/
├── src/
│   ├── main.py (2.5KB)
│   └── utils.py (1.2KB)
├── tests/
│   └── test_main.py (3.1KB)
└── README.md (4.2KB)

## File Contents:

### src/main.py
```python
def main():
    print("Hello, World!")

src/utils.py

def helper():
    return 42

## Use Cases

- 📤 **Share code with LLMs**: Perfect format for ChatGPT, Claude, etc.
- 📚 **Documentation**: Generate project structure docs
- 🔍 **Code review**: Quick project overview
- 🚀 **Onboarding**: Help new team members understand project layout
- 🐛 **Debugging**: Share relevant code context in issues

## License

MIT License. See [LICENSE](LICENSE) file for details.

## Author

**Julius Olsson**
Email: [julius.olsson05@gmail.com](mailto:julius.olsson05@gmail.com)

---

*Built for developers who need to share code context efficiently.*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

folder_crawl-0.2.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

folder_crawl-0.2.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file folder_crawl-0.2.0.tar.gz.

File metadata

  • Download URL: folder_crawl-0.2.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for folder_crawl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 611ae354fb1dd3f066a724331deafb15f5d6f290318c0f4ee305528244d2578d
MD5 94067921993a083016a27c20b42d5e8b
BLAKE2b-256 39b420b7d1cc3414a0db9d25f279ac7b3d04ef85bece04cc6fee60d4fb96f63a

See more details on using hashes here.

File details

Details for the file folder_crawl-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: folder_crawl-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for folder_crawl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcbb6a8307bf1bdda58d4d9cca9e6c490ae811f7f2e92cacf094a6feb3d1797d
MD5 016eecd0af2dea3b4e181ba53afc413a
BLAKE2b-256 f4fd924c52da06681208147fb2d9649d6c90c072de8e1388bf9de0808ee92dea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page