Skip to content

Command Line Interface

Complete reference for all Folder2MD4LLMs command-line options and arguments.

Basic Syntax

folder2md [OPTIONS] [PATHS...]

Arguments

PATHS

Directories or files to process. If not specified, processes the current directory.

# Process current directory
folder2md

# Process specific directory
folder2md /path/to/project

# Process multiple paths
folder2md src/ docs/ tests/

# Process specific files
folder2md README.md src/main.py

Global Options

--version

Show version information and exit.

folder2md --version

--help

Show help message and exit.

folder2md --help

Output Options

--output, -o

Specify output file path.

folder2md --output project-summary.md
folder2md -o summary.md .

Default: output.md

--format

Output format (currently only markdown is supported).

folder2md --format markdown .

Default: markdown

--stats

Include file statistics in output.

folder2md --stats .

Shows: - Total files processed - Total size in bytes and tokens - Processing time - File type breakdown

--no-tree

Disable directory tree in output.

folder2md --no-tree .

Default: Tree is included

Token and Size Management

--token-limit

Maximum tokens in output.

folder2md --token-limit 80000 .
folder2md --token-limit 150000 .

Range: 1,000 to 1,000,000 Default: No limit

--char-limit

Maximum characters in output (alternative to token-limit).

folder2md --char-limit 400000 .

Default: No limit

--max-file-size

Maximum size for individual files (in bytes).

folder2md --max-file-size 1048576 .  # 1MB
folder2md --max-file-size 512000 .   # 512KB

Default: 1,048,576 (1MB)

--max-tokens-per-chunk

Maximum tokens per file chunk.

folder2md --max-tokens-per-chunk 4000 .

Default: 4,000

Smart Condensing

--smart-condensing

Enable intelligent code condensing.

folder2md --smart-condensing --token-limit 80000 .

--no-smart-condensing

Explicitly disable smart condensing.

folder2md --no-smart-condensing .

--condense-strategy

Condensing strategy: conservative, balanced, aggressive.

folder2md --condense-strategy conservative .
folder2md --condense-strategy balanced .
folder2md --condense-strategy aggressive .

Default: balanced

--token-budget-strategy

Token budget allocation strategy.

folder2md --token-budget-strategy conservative .
folder2md --token-budget-strategy balanced .
folder2md --token-budget-strategy aggressive .

Default: balanced

--condense-languages

Specify languages to condense (comma-separated).

folder2md --condense-languages python,javascript .
folder2md --condense-languages python,typescript,java .

Default: All supported languages

--preserve-pattern

Patterns for files to never condense (can be used multiple times).

folder2md --preserve-pattern "**/main.py" --preserve-pattern "**/__init__.py" .

File Filtering

--include-pattern

Include files matching pattern (can be used multiple times).

folder2md --include-pattern "**/*.py" .
folder2md --include-pattern "src/**/*.js" --include-pattern "**/*.md" .

--exclude-pattern

Exclude files matching pattern (can be used multiple times).

folder2md --exclude-pattern "**/__pycache__/**" .
folder2md --exclude-pattern "*.log" --exclude-pattern "tmp/**" .

--use-gitignore / --no-gitignore

Use .gitignore patterns for exclusion.

folder2md --use-gitignore .      # Default
folder2md --no-gitignore .       # Ignore .gitignore files

Default: Enabled

--max-depth

Maximum directory depth to traverse.

folder2md --max-depth 3 .

Default: No limit

Follow symbolic links.

folder2md --follow-symlinks .

Default: Disabled

--include-hidden

Include hidden files and directories.

folder2md --include-hidden .

Default: Disabled

Document Processing

--include-docs

Enable document conversion (PDF, DOCX, etc.).

folder2md --include-docs .

--no-include-docs

Disable document conversion.

folder2md --no-include-docs .

Default: Disabled

--binary-analysis

Enable binary file analysis.

folder2md --binary-analysis .

--no-binary-analysis

Disable binary file analysis.

folder2md --no-binary-analysis .

Default: Disabled

Performance Options

--parallel / --no-parallel

Enable/disable parallel processing.

folder2md --parallel .           # Enable (default)
folder2md --no-parallel .        # Disable

Default: Enabled

--max-workers

Number of worker threads (0 = auto).

folder2md --max-workers 4 .
folder2md --max-workers 8 .

Range: 1 to 32 Default: Auto (CPU count)

--memory-limit

Memory usage warning threshold (MB).

folder2md --memory-limit 1000 .

Default: 1,000 MB

Debugging and Verbose Output

--verbose, -v

Enable verbose output.

folder2md --verbose .
folder2md -v .

--quiet, -q

Suppress non-error output.

folder2md --quiet .
folder2md -q .

--dry-run

Show what would be processed without generating output.

folder2md --dry-run .
folder2md --dry-run --include-pattern "**/*.py" .

--show-progress / --no-progress

Show/hide progress bar.

folder2md --show-progress .      # Default
folder2md --no-progress .

Configuration

--config

Specify configuration file path.

folder2md --config custom-config.yaml .
folder2md --config /path/to/config.yml .

--config-check

Validate configuration file without processing.

folder2md --config-check folder2md.yaml

--init-ignore

Generate .folder2md_ignore template.

folder2md --init-ignore

Creates a comprehensive ignore file template in the current directory.

Update Management

--update-check / --no-update-check

Enable/disable update checking.

folder2md --update-check .       # Default
folder2md --no-update-check .

Default: Enabled

--force-update-check

Force update check even if recently checked.

folder2md --force-update-check .

Environment Variables

Override options with environment variables:

# Disable update checks
export FOLDER2MD_UPDATE_CHECK=false

# Set log level
export FOLDER2MD_LOG_LEVEL=DEBUG

# Custom config file
export FOLDER2MD_CONFIG=/path/to/config.yaml

# Set maximum workers
export FOLDER2MD_MAX_WORKERS=8

Exit Codes

  • 0: Success
  • 1: General error
  • 2: Configuration error
  • 3: File processing error
  • 4: Output error
  • 5: Permission error

Examples

Basic Usage

# Convert current directory
folder2md

# Convert with output file
folder2md --output project.md .

# Convert specific directory
folder2md /path/to/project

With Smart Condensing

# Basic smart condensing
folder2md --smart-condensing --token-limit 80000 .

# Aggressive condensing for large projects
folder2md --smart-condensing --condense-strategy aggressive --token-limit 100000 .

# Conservative condensing with preservation
folder2md --smart-condensing --condense-strategy conservative --preserve-pattern "**/main.py" .

Filtering Examples

# Python project
folder2md --include-pattern "**/*.py" --include-pattern "requirements.txt" .

# Web project
folder2md --include-pattern "src/**/*.{js,ts,jsx,tsx}" --include-pattern "package.json" .

# Exclude build artifacts
folder2md --exclude-pattern "**/node_modules/**" --exclude-pattern "**/dist/**" .

Document Processing

# Include document conversion
folder2md --include-docs --include-pattern "**/*.{md,pdf,docx}" .

# With binary analysis
folder2md --binary-analysis --include-pattern "**" .

Performance Optimization

# Large project optimization
folder2md --parallel --max-workers 8 --max-file-size 500000 .

# Memory-conscious processing
folder2md --no-parallel --memory-limit 500 .

Debugging

# Verbose dry run
folder2md --dry-run --verbose --include-pattern "**/*.py" .

# Check configuration
folder2md --config-check folder2md.yaml

# Test patterns
folder2md --dry-run --include-pattern "src/**" --exclude-pattern "tests/**" .

For more complex scenarios, consider using configuration files instead of long command lines.