Command Line Interface¶
Complete reference for all Folder2MD4LLMs command-line options and arguments.
Basic Syntax¶
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.
--help¶
Show help message and exit.
Output Options¶
--output, -o¶
Specify output file path.
Default: output.md
--format¶
Output format (currently only markdown
is supported).
Default: markdown
--stats¶
Include file statistics in output.
Shows: - Total files processed - Total size in bytes and tokens - Processing time - File type breakdown
--no-tree¶
Disable directory tree in output.
Default: Tree is included
Token and Size Management¶
--token-limit¶
Maximum tokens in output.
Range: 1,000 to 1,000,000 Default: No limit
--char-limit¶
Maximum characters in output (alternative to token-limit).
Default: No limit
--max-file-size¶
Maximum size for individual files (in bytes).
Default: 1,048,576 (1MB)
--max-tokens-per-chunk¶
Maximum tokens per file chunk.
Default: 4,000
Smart Condensing¶
--smart-condensing¶
Enable intelligent code condensing.
--no-smart-condensing¶
Explicitly disable 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).
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.
Default: Enabled
--max-depth¶
Maximum directory depth to traverse.
Default: No limit
--follow-symlinks¶
Follow symbolic links.
Default: Disabled
--include-hidden¶
Include hidden files and directories.
Default: Disabled
Document Processing¶
--include-docs¶
Enable document conversion (PDF, DOCX, etc.).
--no-include-docs¶
Disable document conversion.
Default: Disabled
--binary-analysis¶
Enable binary file analysis.
--no-binary-analysis¶
Disable binary file analysis.
Default: Disabled
Performance Options¶
--parallel / --no-parallel¶
Enable/disable parallel processing.
Default: Enabled
--max-workers¶
Number of worker threads (0 = auto).
Range: 1 to 32 Default: Auto (CPU count)
--memory-limit¶
Memory usage warning threshold (MB).
Default: 1,000 MB
Debugging and Verbose Output¶
--verbose, -v¶
Enable verbose output.
--quiet, -q¶
Suppress non-error output.
--dry-run¶
Show what would be processed without generating output.
--show-progress / --no-progress¶
Show/hide progress bar.
Configuration¶
--config¶
Specify configuration file path.
--config-check¶
Validate configuration file without processing.
--init-ignore¶
Generate .folder2md_ignore template.
Creates a comprehensive ignore file template in the current directory.
Update Management¶
--update-check / --no-update-check¶
Enable/disable update checking.
Default: Enabled
--force-update-check¶
Force update check even if recently checked.
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
: Success1
: General error2
: Configuration error3
: File processing error4
: Output error5
: 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.